home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 8 / Night Owl CD-ROM (NOPV8) (Night Owl Publisher) (1993).ISO / 017a / asic.arj / ASIC.DOC next >
Text File  |  1990-03-04  |  108KB  |  4,152 lines

  1. m6CB
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.        +--------------------------------------------------------------------+
  9.        |                                                                    |
  10.        |                            A S I C   1.0                           |
  11.        |                                                                    |
  12.        |                         "Its Almost Basic"                         |
  13.        |                                                                    |
  14.        |                                                                    |
  15.        |                           Copyright 1989                           |
  16.        |                                by                                  |
  17.        |                           David A. Visti                           |
  18.        |                                                                    |
  19.        |                         All Rights Reserved                        |
  20.        +--------------------------------------------------------------------+
  21.        |    ASIC may be used for personal use at no charge (of course,      |
  22.        |    contributions are always welcome).  Commercial users are        |
  23.        |    asked to send in a $10 registration fee.  Also, feel free to    |
  24.        |    distribute this software to others.  However, you may not       |
  25.        |    charge for the distribution of this software to others nor may  |
  26.        |    you alter the software or this documentation.                   |
  27.        |                                                                    |
  28.        |    I'm always striving to improve the quality of my software, so   |
  29.        |    please pass your suggestions along to me.  I hope you enjoy     |
  30.        |    using ASIC!                                                     |
  31.        +--------------------------------------------------------------------+
  32.        |                                                                    |
  33.        |     Please send registration fees and suggestions to:              |
  34.        |                                                                    |
  35.        |                        David Visti                                 |
  36.        |                        P.O. Box 2952                               |
  37.        |                        Raleigh, NC  27602-2952                     |
  38.        |                                                                    |
  39.        |     Please mention the version of ASIC in any correspondence       |
  40.        |                (This is ASIC Version 1.0)                          |
  41.        +--------------------------------------------------------------------+
  42.        |    I can also be reached for questions/comments on GEnie and       |
  43.        |    Compuserve via EMAIL:                                           |
  44.        |                                                                    |
  45.        |         Compuserve      73065,1302                                 |
  46.        |         GEnie           D.VISTI                                    |
  47.        |                                                                    |
  48.        +--------------------------------------------------------------------+
  49.        |                                                                    |
  50.        |    DISCLAIMER:  This software is provided "as is" without warranty |
  51.        |    of any kind.  In no event shall I be held liable for any        |
  52.        |    damages whatsoever arising from the use of or inability to use  |
  53.        |    this product.                                                   |
  54.        |                                                                    |
  55.        +--------------------------------------------------------------------+
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                       A S I C
  64.                                  Table of Contents
  65.  
  66.          Chapter  Title
  67.  
  68.             1.    Getting Started                               Page  3
  69.             2.    Tutorial                                      Page  5
  70.             3.    Integrated Editor/Compiler Environment        Page 10
  71.             4.    Stand-alone Compiler Options                  Page 16
  72.             5.    Language Elements                             Page 19
  73.             6.    Keyword Reference                             Page 23
  74.                       ABS                             Page 23
  75.                       ASC                             Page 23
  76.                       CHR$                            Page 24
  77.                       CLOSE                           Page 24
  78.                       CLS                             Page 25
  79.                       COLOR                           Page 25
  80.                       CRSLIN                          Page 26
  81.                       DEFSEG                          Page 26
  82.                       DIM                             Page 27
  83.                       END                             Page 27
  84.                       FOR/NEXT                        Page 28
  85.                       GOSUB                           Page 30
  86.                       GOTO                            Page 30
  87.                       IF/THEN/ELSE                    Page 31
  88.                       INKEY$                          Page 32
  89.                       INPUT                           Page 33
  90.                       INPUT#                          Page 34
  91.                       LEN                             Page 35
  92.                       LOCATE                          Page 35
  93.                       LPRINT                          Page 36
  94.                       MID$                            Page 37
  95.                       OPEN                            Page 37
  96.                       PEEK                            Page 38
  97.                       POINT                           Page 38
  98.                       POKE                            Page 39
  99.                       POS                             Page 39
  100.                       PRESET                          Page 40
  101.                       PRINT                           Page 41
  102.                       PRINT#                          Page 42
  103.                       PSET                            Page 43
  104.                       RANDOMIZE                       Page 44
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.                                       Page - 1
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.                            Table of Contents (Continued)
  127.  
  128.          Chapter  Title
  129.             5.    Keyword Reference (Continued)
  130.                       REM                             Page 44
  131.                       RETURN                          Page 44
  132.                       RND                             Page 45
  133.                       SCREEN                          Page 46
  134.                       SOUND                           Page 47
  135.                       STR$                            Page 47
  136.                       VAL                             Page 48
  137.                       VARPTR                          Page 48
  138.                       WIDTH                           Page 49
  139.                       ZMODE                           Page 49
  140.             7.    Compatibility with BASICA/GWBASIC             Page 50
  141.             8.    Technical Details/Tips                        Page 52
  142.             9.    Error Messages                                Page 55
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.                                       Page - 2
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.                                       A S I C
  194.  
  195.                                      Chapter 1
  196.  
  197.                                   Getting Started
  198.  
  199.  
  200.  
  201.                                     INTRODUCTION
  202.  
  203.             Welcome to ASIC!
  204.  
  205.             ASIC is a "BASIC" programming language compiler for IBM PC's and
  206.        compatibles.  It includes an integrated full screen editor, from which
  207.        you can edit, compile, and execute your programs.  Or at your option,
  208.        you can use your own text editor, and compile your programs from the
  209.        MS DOS command line.
  210.  
  211.             ASIC is a subset of BASICA and GWBASIC which supports over 40
  212.        BASIC statements, integer and string variables, and integer arrays.
  213.        It will compile your programs at high speed, and the code it generates
  214.        is fast and compact.  The syntax of each ASIC statement is generally a
  215.        valid subset of the syntax used by BASICA and GWBASIC (exceptions are
  216.        noted in Chapter 7.)
  217.  
  218.  
  219.             All you need to get started is:
  220.  
  221.                  1)  ASIC
  222.                  2)  IBM PC or 100% Compatible
  223.                  3)  320-400k Available Memory*
  224.                  4)  Two floppy disk drives
  225.                           <or>
  226.                      One hard disk drive and one floppy disk drive
  227.  
  228.             The first step is to install ASIC as described below.  Then,
  229.        proceed to Chapter 2 for a brief ASIC tutorial.  Following that you
  230.        can read the remainder of the documentation straight through, or refer
  231.        to it as you need it.  Have Fun!
  232.  
  233.  
  234.             *  The ASIC Compiler and Editor will each run in 320k of memory,
  235.                however, to compile from within the editor, requires 400k of
  236.                memory.  If ASIC does not find sufficient memory to call the
  237.                compiler from within the editor, it will ignore the compile
  238.                request and return to the editor.
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.                                       Page - 3
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.                                     INSTALLATION
  258.  
  259.  
  260.          To install ASIC execute the following commands as appropriate for
  261.        your machine.  The procedure to do so is provided below for both
  262.        floppy systems and hard disk based systems.  Also refer to the README
  263.        file on your ASIC Diskette for additional information.
  264.  
  265.  
  266.        TWO-FLOPPY DISK SYSTEM INSTALLATION
  267.  
  268.        1)  Make sure that the following files are all on the same diskette
  269.        (the diskette that contains these files will be referred to in this
  270.        manual as the "Compiler" diskette):
  271.  
  272.                  ASIC.EXE
  273.                  ASICC.EXE
  274.  
  275.        2)  Format one or more blank diskettes to hold your programs (these
  276.        diskettes will be referred to in this manual as your "Program"
  277.        diskettes):
  278.  
  279.                  Note:  Whenever you see the symbol     <enter>    in this
  280.                         document, this refers to the <enter> or <return> key
  281.                         on your keyboard.
  282.  
  283.  
  284.        HARD DISK SYSTEM INSTALLATION
  285.  
  286.        1)  Type:   C: <enter>
  287.        2)  Type:   MD C:\ASIC <enter>
  288.        3)  The next step is to copy the ASIC software to the ASIC directory.
  289.  
  290.            If your ASIC software is on a floppy, insert the floppy in Drive
  291.            A: then type the command:
  292.  
  293.                   COPY A:*.* C:\ASIC <enter>
  294.  
  295.            If your ASIC software is already on a hard disk directory, copy
  296.            it to the ASIC directory with the command:
  297.  
  298.                   COPY C:\directoryname\*.* C:\ASIC <enter>
  299.  
  300.             Note that ASIC will run from any subdirectory, however, the
  301.             tutorial assumes ASIC is under C:\ASIC
  302.  
  303.                  Note:  Whenever you see the symbol     <enter>    in this
  304.                         document, this refers to the <enter> or <return> key
  305.                         on your keyboard.
  306.  
  307.  
  308.  
  309.  
  310.  
  311.                                       Page - 4
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.                                       A S I C
  322.  
  323.                                      Chapter 2
  324.  
  325.                                       Tutorial
  326.  
  327.  
  328.        ASIC programs look very much like regular "BASIC" programs which you
  329.        are probably already familiar with.  The one very noticeable
  330.        difference is that ASIC programs have no line numbers.  Let's take a
  331.        look at a very simple program written both in GWBASIC/BASICA and in
  332.        ASIC:
  333.  
  334.             GWBASIC/BASICA                          ASIC
  335.             --------------------------+----------------------------------
  336.                                       |
  337.             10  I=I+1                 |   ADDONE: I=I+1
  338.             20  PRINT I               |           PRINT I
  339.             30  IF I<100 THEN 10      |           IF I<100 THEN ADDONE:
  340.             --------------------------+----------------------------------
  341.  
  342.             Both of these programs do the same thing.  They display the
  343.        numbers from 1 to 100.  However, notice that ASIC allows you to use
  344.        descriptive labels (ADDONE) instead of a line number (10).  These
  345.        labels can be up to 80 characters long!  Also note that the ASIC
  346.        "PRINT" and "IF" statements were indented only for increased program
  347.        readability.  The ASIC program could just as well have been written
  348.        as:
  349.  
  350.                                         ASIC
  351.                            ------------------------------
  352.                            ADDONE:I=I+1
  353.                            PRINT I
  354.                            IF I<100 THEN ADDONE:
  355.                            ------------------------------
  356.  
  357.             We could have made our variable names longer.  Instead of "I" we
  358.        could have chosen "SECONDS" or "VELOCITY", or some other name up to 80
  359.        characters in total.  In ASIC, variable names, labels, and string
  360.        constants can all be up to 80 characters in length.
  361.  
  362.             Well, now that we've seen a basic ASIC program, let's try to
  363.        enter and run a slightly larger program.  The program we will be
  364.        working with will print the message "HELLO yourname" in 256 color
  365.        combinations.  If you have a monochrome display card, don't worry, the
  366.        program will work, but instead of seeing different colors you'll see
  367.        characters with different attributes, such as blinking, underlined,
  368.        etc.
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.                                       Page - 5
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.             Let's get started.  If you haven't done so already, install ASIC
  383.        as described in Chapter 1.  Now then, writing an ASIC program involves
  384.        these three steps.
  385.  
  386.             1.  Write your program.
  387.             2.  Compile your program.
  388.             3.  Run your Program.
  389.  
  390.             These three steps can all be performed from within the ASIC
  391.        Integrated Environment.  Before we proceed with our "Hello yourname"
  392.        Program, let's go over some conventions.
  393.  
  394.  
  395.             In the following section:
  396.  
  397.             FLOPPY TYPE-->       Means that only 2-floppy disk system users
  398.                                  should type this line.
  399.  
  400.             HARD TYPE-->         Means that only hard disk system users
  401.                                  should type this line.
  402.  
  403.             TYPE-->              Means that both floppy and hard disk users
  404.                                  should type this line.
  405.  
  406.             X>                   This is a representation of the prompt from
  407.                                  PC-DOS or MS-DOS.  Floppy Disk Users will
  408.                                  actually see "A>" for a prompt.  Hard Disk
  409.                                  Users will see "C>" for a prompt.
  410.  
  411.             <enter>              Means that you should press the <enter>
  412.                                  or <return> key on your keyboard.
  413.  
  414.             <?>                  Text enclosed between the "<" and the ">"
  415.                                  symbols indicate a key to type.  Don't type
  416.                                  the "<" or ">" symbols.  For example, if the
  417.                                  tutorial lists "<F1>", your should press the
  418.                                  "F1" key on your keyboard.
  419.  
  420.        NOTE:  Floppy Disk users need to insert their ASIC Compiler diskette
  421.        in Drive A: at this point, and a Program diskette in Drive B:  (See
  422.        the Installation section for more information)
  423.  
  424.  
  425.        Let's begin:
  426.  
  427.  
  428.                  FLOPPY TYPE-->      A: <enter>
  429.                  HARD TYPE-->        CD C:\ASIC <enter>
  430.  
  431.        The computer should respond:
  432.  
  433.                                      X>
  434.  
  435.        Now enter the command to invoke ASIC
  436.  
  437.  
  438.  
  439.                                       Page - 6
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.                  TYPE-->      ASIC <enter>
  448.  
  449.        You are now in ASIC.  The top line is the Menu Bar.  The bottom line
  450.        is the Status Line.  Chapter 3 describes these features in more
  451.        detail.  For now, we'll just describe a couple of features on these
  452.        lines.
  453.  
  454.        The status line indicates that the current mode is "INSERT".  This
  455.        means that any characters you type on a line will be inserted between
  456.        the existing characters.  If you press the <INS> key on the keypad,
  457.        ASIC will toggle to it's other mode, OVERSTRIKE.  In this mode, when
  458.        you type a character, it overlays the character that was there before.
  459.        Each time you press the <INS> key, ASIC will toggle between the INSERT
  460.        and OVERSTRIKE modes.
  461.  
  462.        You can open the menus listed on the "Menu Bar" by holding down the
  463.        ALT key while typing the Capitalized letter of the menu you wish to
  464.        open.  For example, to open the File menu, press <ALT><F>.  The "File"
  465.        menu will pop open.  You can select a menu option from that menu by
  466.        typing the capitalized letter of the option, or by using the arrow
  467.        keys on your keypad to highlight the option you want and then pressing
  468.        <enter>.  Let's leave this menu for now.  To do so, press the <ESC>
  469.        key.  The <ESC> key will always let you escape from any menu in ASIC,
  470.        without taking any action.
  471.  
  472.        If you need help, press the <F1> key for a quick summary of some of
  473.        ASIC's features.  Chapter 3 gives a full description of the ASIC
  474.        Editor Commands which are available.
  475.  
  476.        Entering a program in ASIC is simplicity itself.  We'll simply type in
  477.        each line, pressing <enter> at the end of each line.  If you make a
  478.        typing mistake, just use the arrow keys to move to the error, and type
  479.        in the correction.  Use the <DEL> or <Backspace> keys to delete any
  480.        unwanted characters from the screen.
  481.  
  482.        Make sure the status line says "Mode: Insert".  This is the default
  483.        mode in ASIC.  If it doesn't, press the <INS> key until it does.  Now
  484.        let's enter our program (the program below intentionally contains an
  485.        invalid ASIC statement.  We'll correct the line later in the tutorial,
  486.        for now, type in the program exactly as it's listed below):
  487.  
  488.                  TYPE-->        CLS  <enter>
  489.                  TYPE-->        PRINT "Please enter your name"; <enter>
  490.                  TYPE-->        INPUT YOURNAME$  <enter>
  491.                  TYPE-->        FOR I=1 TO 16  <enter>
  492.                  TYPE-->            FOR J=1 TO 16  <enter>
  493.                  TYPE-->                COLOR I,J <enter>
  494.                  TYPE-->                PRINT "HELLO "; <enter>
  495.                  TYPE-->                PRINT YOURNAME$; <enter>
  496.                  TYPE-->            NEXT J <enter>
  497.                  TYPE-->        NEXT I <enter>
  498.                  TYPE-->        CLS <enter>
  499.                  TYPE-->        THE END <enter>
  500.  
  501.  
  502.  
  503.                                       Page - 7
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.        There, that was easy.  Now, let's compile our program.  To do it,
  514.        we'll open the "Compile" menu, and select the "Compile program"
  515.        option:
  516.  
  517.                  TYPE-->       <ALT><C>
  518.  
  519.        The "Compile" menu will pop open.  The first option, "Compile program"
  520.        can be selected by typing the option letter which is capitalized "C",
  521.        or by moving the highlight bar to this option and pressing the <enter>
  522.        key.  Since the highlight bar is already on this option, let's just
  523.        press <enter>:
  524.  
  525.                  TYPE-->       <enter>
  526.  
  527.        Since we didn't specify a file name when we invoked ASIC, ASIC will
  528.        now ask for a file name (so it can save your program before calling
  529.        the compiler):
  530.  
  531.                  FLOPPY TYPE-->      B:TUTOR.ASI  <enter>
  532.                  HARD TYPE-->        TUTOR.ASI <enter>
  533.  
  534.        Note that ASIC requires that your programs be stored in files ending
  535.        with the extension ".ASI".  Had we entered "TUTOR" for our program
  536.        name, ASIC would have appended the letters ".ASI" for us.  If we tried
  537.        to provide a different extension, such as "TUTOR.SRC", ASIC would
  538.        display an error message.  Also, whenever you are presented a dialog
  539.        box where you are asked to enter text (such as file name, or Y/N
  540.        responses to questions), you must press the <enter> key before ASIC
  541.        will accept the input.
  542.  
  543.        Once you select the "Compile program" option, you'll see the ASIC
  544.        compiler screen appear.  It will display a count of the lines
  545.        compiled, and when it is done, it will return to the ASIC editor.
  546.  
  547.        If it detected any errors, it will display the first error message at
  548.        the bottom of the editor screen.  It will also highlight the line in
  549.        your program which is in error.  In this case the line "THE END" was
  550.        flagged with the error message "Syntax Error".  Of course, that line
  551.        should have been entered simply as "END".
  552.  
  553.        That should be easy enough to fix.  Let's exit the error menu by
  554.        pressing the <ESC> key:
  555.  
  556.             TYPE-->      <ESC>
  557.  
  558.        The error menu has disappeared, and our cursor is now on the erroneous
  559.        line.  To fix the line:
  560.  
  561.             TYPE-->      <DEL><DEL><DEL><DEL>
  562.  
  563.  
  564.  
  565.  
  566.  
  567.                                       Page - 8
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.        That should do it.  The last line of our program should now read
  576.        "END".  Let's recompile the program:
  577.  
  578.             TYPE-->      <ALT><C>
  579.             TYPE-->      <enter>
  580.  
  581.        This time you should see the message "No Compiler Errors". If you
  582.        didn't, check your spelling and recompile the program until you
  583.        receive this message.  Press <ESC> to remove the "No Compiler Errors"
  584.        Window.
  585.  
  586.        Now let's run the program.  To do so, we'll open the "Compile" menu,
  587.        and select the "Run your program" option.
  588.  
  589.             TYPE-->      <ALT><C>
  590.             TYPE-->      <r>
  591.  
  592.        This time, we just entered the capitalized letter from the menu option
  593.        "Run your program".  Your computer screen should now prompt you to
  594.        "Please enter your name?".  Go ahead and enter your name now:
  595.  
  596.             TYPE-->      yourname  <enter>
  597.  
  598.        You should see "HELLO yourname" printed in various color combinations,
  599.        and then the ASIC editor screen will reappear.  Well, that's all there
  600.        is to writing, compiling, and running an ASIC program.  Now, to exit
  601.        ASIC, open the "File" menu and select the "eXit" option.
  602.  
  603.             TYPE-->      <ALT><F>
  604.             TYPE-->      <X>
  605.  
  606.        You should see your MS DOS prompt once again.  By the way, now that
  607.        you've successfully compiled the program, you can execute it directly
  608.        from MS DOS.  Let's try it:
  609.  
  610.             HARD TYPE-->     TUTOR <enter>
  611.             FLOPPY TYPE-->   B:TUTOR <enter>
  612.  
  613.        Well, that's a brief introduction to ASIC!  Next, you might want to
  614.        read Chapter 3, "Integrated Editor/Compiler Environment" to learn
  615.        about the many other features available in the ASIC editor.  Chapters
  616.        5-7 describe the BASIC statements which are supported by ASIC.
  617.        Chapter 9 provides more descriptive information for ASIC error
  618.        messages.
  619.  
  620.        Hope you enjoy programming in ASIC!
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.                                       Page - 9
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.                                       A S I C
  642.  
  643.                                      Chapter 3
  644.  
  645.                              Integrated Editor/Compiler
  646.                                     Environment
  647.  
  648.  
  649.                                     INTRODUCTION
  650.  
  651.             The ASIC integrated environment lets you edit, save, compile, and
  652.        run your ASIC programs without ever leaving ASIC!  This chapter will
  653.        explain the usage of the integrated environment.
  654.  
  655.  
  656.                                 ASIC SCREEN CONTENTS
  657.  
  658.  
  659.             ASIC divides the screen into three parts.  The top line is called
  660.        the "Menu Bar".  All of the menu's available to you are listed on this
  661.        line.  The bottom Line is called the "Status Line".  It continuously
  662.        displays some important program information.  The middle 23 lines are
  663.        the "Edit Window".  This is the section of the screen where you can
  664.        make changes or additions to your program.
  665.  
  666.                                 MENU BAR PROCESSING
  667.  
  668.        Currently, there are three menu's available.  The "File" menu allows
  669.        you to load/save your existing program files to/from disk.  It is also
  670.        used to exit ASIC.  The "Edit" menu contains various editing commands
  671.        which are available.  The "Compile" menu is used to compile your
  672.        program, run your program, set compiler options, and to view compiler
  673.        errors.
  674.  
  675.             To open a menu, hold down the <ALT> key and type the first letter
  676.        of the menu.  The menu will pop down and display the options available
  677.        on that menu.  If you want to close the menu without taking any
  678.        action, press the <ESC> key.  Otherwise, to select an option, either
  679.        type the capitalized letter of the menu option.  For example, on the
  680.        "File" menu, to select the "eXit" option, type an "X" or an "x".
  681.        Another way to select an option is to move the "Highlighted Bar" down
  682.        to the option you wish to select, and press the <enter> key.
  683.  
  684.             Now let's describe the options available on each menu.
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.                                      Page - 10
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.                                      FILE MENU
  705.  
  706.        "Open" Option
  707.  
  708.             This option allows you to open an existing ASIC file and load it
  709.        into the ASIC edit buffer where you can modify it.  If you select this
  710.        option another window will open to ask you the file name.  If you
  711.        don't wish to open a file, you can press <ESC> to close the menu
  712.        without taking any action.  Otherwise, enter an ASIC file name, and
  713.        press the <enter> key.
  714.  
  715.        "Save" Option
  716.  
  717.             This option allows you to write the changes you've made to your
  718.        program back to the file.  Changes you enter in the ASIC editor are
  719.        made to memory only.  You must select this option before your changes
  720.        will become permanent.  Note:  Your file is saved to disk
  721.        automatically whenever you compile it, or run it, if the file modified
  722.        indicator is set.
  723.  
  724.        "save As" Option
  725.  
  726.             This option will allow you to write the changes you've made to
  727.        the program in the edit buffer to a new file.  You will be prompted to
  728.        provide ASIC with a new file name.
  729.  
  730.        "eXit" Option
  731.  
  732.             This option will allow you to exit from ASIC back to MS DOS.
  733.        ASIC will ask you if you wish to save your file before you exit.
  734.  
  735.  
  736.                                      EDIT MENU
  737.  
  738.        "Begin block" Option
  739.  
  740.             This option will allow you to mark the beginning of a block of
  741.        text for use with the block delete, copy, and move commands described
  742.        below.  To mark a block of text, move the cursor to the first line of
  743.        the block, and then select this option.  The beginning line of the
  744.        block will be highlighted on the screen.  Next, move the cursor to the
  745.        ending line of the block, and select the "End block" option from this
  746.        menu.  All of the lines in the block will be highlighted.  This block
  747.        of lines can now be "moved", "copied", or "deleted" using the block
  748.        commands described below.
  749.  
  750.        "End block" Option
  751.  
  752.             This option will allow you to mark the end of a block of text.
  753.        Refer to the "Begin block" Option above for more information.
  754.  
  755.  
  756.  
  757.  
  758.  
  759.                                      Page - 11
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.        "Delete block" Option
  768.  
  769.             This option will delete a block of lines.  Refer to the "Begin
  770.        block" option above for information on marking a block of lines.  If
  771.        you haven't marked a block of lines, selecting this option will have
  772.        no effect.
  773.  
  774.        "Move block" Option
  775.  
  776.             This option will move a block of lines to a new location in the
  777.        edit buffer.  Refer to the "Begin block" option above for information
  778.        on marking a block of lines.  If you don't mark a block of lines,
  779.        selecting this option will have no effect.  Once you have marked a
  780.        block of lines, move the cursor to the location in the edit buffer
  781.        where you want the lines moved. Selecting the "Move block" option will
  782.        result in the block of lines being deleted from their current
  783.        location, and moved to the buffer at the line following the cursor.
  784.        ASIC will not overlay lines, it will insert enough blank space to hold
  785.        the relocated text.
  786.  
  787.        "Copy block" Option
  788.  
  789.             This option is the same as the "Move block" option, with one
  790.        exception.  After moving the block, ASIC does NOT delete the original
  791.        block of lines.  Use this option to clone a block of text.
  792.  
  793.        "Search" Option
  794.  
  795.             This option allows you to locate a string of characters in the
  796.        edit buffer.  When you select this option, ASIC will ask you for a
  797.        search string which can be up to 30 characters in length.  ASIC will
  798.        then search forward from the current line until it finds the string or
  799.        reaches the end of the edit buffer.  If it finds the string, the
  800.        cursor will be placed on the line containing the string.
  801.  
  802.        "Replace" Option
  803.  
  804.             This option will allow you to replace one or more occurrences of
  805.        a string of characters with another set of characters.  When you
  806.        select this option, ASIC will ask you for a search string which can be
  807.        up to 30 characters in length.  ASIC will then ask you for the string
  808.        of characters which is to replace the search string.  Finally, ASIC
  809.        will ask you to specify how many occurrences of this search string are
  810.        to be replaced (from 1-9999).  ASIC will search forward from the
  811.        current line, and briefly display each line as it modifies it.  If it
  812.        reaches the end of the edit buffer before it has replaced the number
  813.        of occurrences you've specified, ASIC will display and "End of Buffer"
  814.        message, and stop.
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.                                      Page - 12
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.                                     COMPILE MENU
  833.  
  834.        "Compile program" Option
  835.  
  836.             Use this option to have ASIC compile the program which is
  837.        currently loaded in the edit buffer.  If the compile is successful,
  838.        ASIC will display the message "No Compiler Errors".  Otherwise, it
  839.        will display the first error message (see "View compile errors" option
  840.        below).  ASIC will automatically save your program before calling the
  841.        compiler.
  842.  
  843.        "Full program listing" Option
  844.  
  845.             This menu option, and the next two options are used to toggle
  846.        various compiler options on or off.  When the option is on, you will
  847.        see a "{" symbol next to the option.  This compiler option will cause
  848.        ASIC to display each source line as it compiles it.  This option will
  849.        slow down the compile, but since ASIC also writes these lines to a
  850.        listing file, this option can be used to create a compile listing.
  851.        The compile listing will be contained in a file called "progname.LST",
  852.        where "progname" is the name of your program.
  853.  
  854.        "Printer output" Option
  855.  
  856.             This menu option, will toggle the "Printer output" option on or
  857.        off.  When the option is on, you will see a "{" symbol next to the
  858.        option name.  This compiler option will cause compiler messages to be
  859.        printed on your printer.
  860.  
  861.        "Symbol table" Option
  862.  
  863.             This menu option, will toggle the "Symbol table" option on or
  864.        off.  When the option is on, you will see a "{" symbol next to the
  865.        option name.  This compiler option will cause ASIC to create a symbol
  866.        table file called "progname.SYM", where "progname" is the name of your
  867.        program.  The symbol table is a list of all variables, labels, and
  868.        internally created compiler addresses.
  869.  
  870.        "Run your program" Option
  871.  
  872.             After you have successfully compiled your program, you can select
  873.        this option to cause ASIC to load and execute your program.  After
  874.        your program ENDs, ASIC will return you to the editor.  ASIC will save
  875.        the edit buffer before loading and executing your program.
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.                                      Page - 13
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.        "View compile errors" Option
  896.  
  897.             When you wish to examine the errors from a previous compile of
  898.        your program, select this option.  If no errors exist, ASIC will so
  899.        inform you.  Otherwise, ASIC will display the first error message at
  900.        the bottom of the screen, and it will highlight the line of your
  901.        program which corresponds to that error.  If you wish to correct the
  902.        program line, press the <ESC> key.  The cursor will be positioned at
  903.        the beginning of that program line.  You may also view subsequent
  904.        compiler errors by pressing the <F10> key instead of the <ESC> key.
  905.  
  906.                                     STATUS LINE
  907.  
  908.             The bottom line of the ASIC screen is called the "Status Line".
  909.        As it's name implies, it is used to display various types of status
  910.        information.  At the left of the status line "FILE: xxxxxxxx.xxx" will
  911.        display the name of the file which is currently loaded in the edit
  912.        buffer.  If you haven't opened a file yet, the file name will be
  913.        blank.
  914.  
  915.  
  916.             After the file name is the "File Modified Indicator".  If you
  917.        have entered any changes in the edit buffer, and have not saved them
  918.        to disk, an "*" will appear to indicate this.  If the edit buffer has
  919.        not been modified since the last save to disk, no "*" will be present.
  920.  
  921.             The next piece of information is "Mode:".  Mode will always
  922.        display one of two values:  "Insert" or "Ovrstr".  In "Insert" mode,
  923.        any characters you type in the edit buffer will be inserted at the
  924.        cursor position, and the characters to the right of the cursor will be
  925.        shifted to the right by one.  In "Ovrstr" mode, any characters you
  926.        type in the edit buffer will overlay (and thus destroy) the character
  927.        at the cursor position.  You can change back and forth between these
  928.        two modes by pressing the <INS> key on your keypad.
  929.  
  930.             To the right of "Mode:" ASIC displays the number of bytes which
  931.        it allocated to the edit buffer.  Divide this number by 81 to get a
  932.        rough idea of how many lines will fit in the edit buffer.
  933.  
  934.             The "Line: nnnn" status indicator, will identify which line of
  935.        the file is being displayed.  For example, if the display reads "Line:
  936.        100", the line containing the cursor is the 100th line in the file.
  937.  
  938.             The "Row:" and "Col:" numbers identify the relative position of
  939.        the cursor within the "Edit Window".
  940.  
  941.  
  942.  
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.                                      Page - 14
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.                                     EDIT WINDOW
  960.  
  961.             The edit window is the area of the screen where your program is
  962.        displayed.  It displays 23 lines of your program at a time.  You can
  963.        use the keys described below to manipulate the text in this window.
  964.  
  965.  
  966.                                    KEYBOARD USAGE
  967.  
  968.             Most keys on the keyboard behave in ASIC just as you'd expect.
  969.        The key usages which might not be obvious are described here.
  970.  
  971.        <ESC>          Exit from any menu without taking any action.
  972.  
  973.        <TAB>          Move the cursor to the next "tab stop".  Tab stops in
  974.                       ASIC are fixed at every fourth column (4,8,12,etc).
  975.  
  976.        <HOME>         Move the cursor to the beginning of the current line.
  977.  
  978.        <END>          Move the cursor to the last non-blank character on the
  979.                       current line.
  980.  
  981.        <DEL>          Delete the character at the cursor position.
  982.  
  983.        <INS>          Toggle between Insert and Overstrike Modes.
  984.  
  985.        <PGUP>         Display the previous 23 lines in the edit buffer.
  986.  
  987.        <PGDN>         Display the next 23 lines in the edit buffer.
  988.  
  989.        <Ctl-PGUP>     Display the first 23 lines in the edit buffer.
  990.  
  991.        <Ctl-PGDN>     Display the last 23 lines in the edit buffer.
  992.  
  993.        <Backspace>    Delete the character at the cursor position, and
  994.                       move the cursor one column to the left.
  995.  
  996.        <Up Arrow>     Moves cursor up one line.
  997.  
  998.        <Down Arrow>   Moves cursor down one line.
  999.  
  1000.        <Left Arrow>   Moves cursor left one column.
  1001.  
  1002.        <Right Arrow>  Moves cursor right one column.
  1003.  
  1004.        <Alt-D>        Delete the line containing the cursor.
  1005.  
  1006.        <Alt-A>        Add a line following the line containing the cursor.
  1007.  
  1008.        <enter>        In Insert mode, pressing <enter> is identical to
  1009.                       pressing <Alt-A>.  In OvrStr mode, pressing <enter>
  1010.                       is identical to pressing the <Down Arrow> key.
  1011.  
  1012.  
  1013.  
  1014.  
  1015.                                      Page - 15
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  
  1021.  
  1022.  
  1023.  
  1024.  
  1025.                                       A S I C
  1026.  
  1027.                                      Chapter 4
  1028.  
  1029.                                   Compiler Options
  1030.  
  1031.  
  1032.                                 COMMAND LINE SYNTAX
  1033.  
  1034.  
  1035.        Invoke the command line version of the compiler as follows:
  1036.  
  1037.  
  1038.             ASICC filename option1 option2 option3 option4 option5 option6
  1039.  
  1040.  
  1041.             Where:         filename  is the name of the source program to be
  1042.                                      compiled.  This file must have the file
  1043.                                      extension ".ASI", although the extension
  1044.                                      may be omitted from the command line.
  1045.  
  1046.                            optionN   specifies any options desired.  No
  1047.                                      options are required, but as many as
  1048.                                      six may be specified.
  1049.  
  1050.  
  1051.                                   COMPILER OPTIONS
  1052.  
  1053.  
  1054.  
  1055.        A total of five compiler switches are currently available for ASIC.
  1056.        Each is described in detail below:
  1057.  
  1058.  
  1059.        Switch         Description
  1060.  
  1061.          C            CONTINUE--ASIC will not pause after messages are
  1062.                                 issued, but will continue compiling.
  1063.  
  1064.                       Default:  ASIC will pause after each error message.
  1065.                                 Compilation will resume after you press
  1066.                                 a key.
  1067.  
  1068.  
  1069.  
  1070.  
  1071.  
  1072.  
  1073.  
  1074.  
  1075.  
  1076.  
  1077.  
  1078.  
  1079.                                      Page - 16
  1080.  
  1081.  
  1082.  
  1083.  
  1084.  
  1085.  
  1086.  
  1087.        Switch         Description
  1088.  
  1089.          L            LIST ALL--ASIC will list each source line as it
  1090.                                 compiles it.
  1091.  
  1092.                       Default:  ASIC will list only source lines with
  1093.                                 compile errors.
  1094.  
  1095.                       Comment:  Use of this switch will slow compile
  1096.                                 speeds slightly due to the additional
  1097.                                 screen I/O.
  1098.  
  1099.  
  1100.          P            PRINTLIST--ASIC will echo all messages which
  1101.                                 appear on the screen to the printer.
  1102.                                 Output to the printer will be paged
  1103.                                 with header lines identifying the
  1104.                                 program name, and the date/time
  1105.                                 compiled.
  1106.  
  1107.                       Default:  ASIC will not send any messages to
  1108.                                 the printer.
  1109.  
  1110.                       Comments: Even though output to the printer is
  1111.                                 buffered, this option will slow compile
  1112.                                 speeds considerably.  The compiler typically
  1113.                                 compiles only as fast as your printer
  1114.                                 can print the messages.  An alternative
  1115.                                 to this switch is the DISKLIST option
  1116.                                 described below.
  1117.  
  1118.  
  1119.          D            DISKLIST--ASIC will echo all screen messages to a disk
  1120.                                 file named "progname.LST".  The format is
  1121.                                 the same produced by PRINTLIST.  This allows
  1122.                                 you to compile at higher speed, and print
  1123.                                 the source listing later from the disk file
  1124.                                 via the DOS print spooler.
  1125.  
  1126.                       Default:  ASIC does not produce a ".LST" file.
  1127.  
  1128.  
  1129.          S            SYMTAB----ASIC will produce a formatted Symbol Table
  1130.                                 in a file named "progname.SYM".  The symbol
  1131.                                 table contains a list of all variables,
  1132.                                 labels, and internally created compiler
  1133.                                 addresses.
  1134.  
  1135.                       Default:  ASIC does not produce a ".SYM" file.
  1136.  
  1137.  
  1138.  
  1139.  
  1140.  
  1141.  
  1142.  
  1143.                                      Page - 17
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.                                   COMPILE EXAMPLES
  1153.  
  1154.  
  1155.        Example 1:  Compile "MYFILE.ASI" with default compiler options:
  1156.  
  1157.  
  1158.                       ASICC MYFILE
  1159.  
  1160.  
  1161.        Example 2:  Compile "MYPROG.ASI", Listing all source lines, writing
  1162.                    a compile listing to a disk file for printing later.  The
  1163.                    listing file will be called "MYPROG.LST":
  1164.  
  1165.                       ASICC MYPROG L D
  1166.  
  1167.  
  1168.        Example 3:  Compile "FILEX.ASI", don't pause for any errors, and
  1169.                    print the errors on the printer:
  1170.  
  1171.                       ASICC FILEX C P
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.                                      Page - 18
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.                                       A S I C
  1218.  
  1219.                                      Chapter 5
  1220.  
  1221.                                  Language Elements
  1222.  
  1223.  
  1224.  
  1225.                                    CHARACTER SET
  1226.  
  1227.  
  1228.        Symbol         Description
  1229.  
  1230.          *            Multiplication
  1231.                       Example: A=B*C  (multiply B by C, store result in A)
  1232.  
  1233.          /            Division
  1234.                       Example: A=B/C  (divide B by C, store result in A)
  1235.  
  1236.          +            Addition
  1237.                       Example: A=B+C  (add C to B, store result in A)
  1238.  
  1239.          +            String Concatenation
  1240.                       Example: A$="AB"+"C"   (A$ will contain "ABC")
  1241.  
  1242.          =            Assignment
  1243.                       Example: A=1    (A will be assigned the value 1)
  1244.  
  1245.          =            Equality testing
  1246.                       Example: IF A=1 THEN QUIT:  (If the value stored in
  1247.                            (A equals 1 goto label QUIT)
  1248.  
  1249.          -            Subtraction
  1250.                       Example: A=B-C   (Subtract C from B, store result in A)
  1251.  
  1252.          "            String Delimiter
  1253.                       Example: A$="the string is inside quote marks"
  1254.  
  1255.          ()           Parenthesis -- Ignored by ASIC
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263.  
  1264.  
  1265.  
  1266.  
  1267.  
  1268.  
  1269.  
  1270.  
  1271.                                      Page - 19
  1272.  
  1273.  
  1274.  
  1275.  
  1276.  
  1277.  
  1278.  
  1279.        Symbol         Description
  1280.  
  1281.          ;            Suppress Carriage Return/Line Feed with PRINT/LPRINT
  1282.  
  1283.          #            Used to identify file usage with PRINT#/INPUT#
  1284.  
  1285.          ,            Comma,  Ignored by ASIC
  1286.  
  1287.          $            Distinguishes a String Variable from an Integer.
  1288.                       Example:    ABC$   <---- string variable
  1289.                       Example:    ABC    <---- integer variable
  1290.  
  1291.          :            Distinguishes a Label from a variable name.
  1292.                       Example:    START:    <---Label name
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332.  
  1333.  
  1334.  
  1335.                                      Page - 20
  1336.  
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.                           CONSTANTS, VARIABLES, AND LABELS
  1345.  
  1346.  
  1347.        ASIC supports the following data types:  Integer Constants, Integer
  1348.        Variables, single dimension Integer Arrays, String Constants, and
  1349.        String Variables.  The following describes the restrictions for each
  1350.        data type.
  1351.  
  1352.  
  1353.        INTEGER CONSTANTS   Range  +32767 to -32767
  1354.  
  1355.                            Example:       -26
  1356.  
  1357.        INTEGER VARIABLE    Described by a variable name beginning with a
  1358.                            letter, followed by up to 79 additional letters
  1359.                            or numbers.  It may contain a number in the range
  1360.                            +32767 to -32767.
  1361.  
  1362.                            Example:       VELOCITY1
  1363.  
  1364.        INTEGER ARRAY       Described by a variable name beginning with a
  1365.                            letter, followed by up to 79 additional letters
  1366.                            or numbers.  This name is followed by an
  1367.                            integer variable or constant for the dimension
  1368.                            of the array.  Arrays must be dimensioned at the
  1369.                            beginning of the program.  See the DIM statement.
  1370.  
  1371.                            Example:       GROWTH (YEAR)
  1372.  
  1373.        STRING CONSTANT     A group of 0-80 characters enclosed by quotation
  1374.                            marks.
  1375.  
  1376.                            Example:       "This is a String Constant"
  1377.  
  1378.        STRING VARIABLE     Described by a variable name which begins with a
  1379.                            letter, followed by up to 78 additional
  1380.                            letters or numbers, terminated with a "$".
  1381.                            Can contain 0-80 characters.
  1382.  
  1383.                            Example:       ADDRESS$
  1384.  
  1385.        LABEL               A Label is a location in your program you wish
  1386.                            to transfer to.  It must begin with a letter,
  1387.                            and it may contain up to 78 additional letters
  1388.                            or numbers.  It must be terminated with a ":".
  1389.  
  1390.                            Example:       START:
  1391.  
  1392.  
  1393.  
  1394.  
  1395.  
  1396.  
  1397.  
  1398.  
  1399.                                      Page - 21
  1400.  
  1401.  
  1402.  
  1403.  
  1404.  
  1405.  
  1406.  
  1407.  
  1408.                               VARIABLES VS. CONSTANTS
  1409.  
  1410.  
  1411.        In general, ASIC will allow the use of either variables, arrays, or
  1412.        constants as operands to any program statement.  For example:
  1413.  
  1414.  
  1415.                       PRINT CASH
  1416.                       PRINT 20
  1417.                       PRINT A(10)
  1418.  
  1419.        All three of the above examples are valid.  The only case where a
  1420.        constant cannot be used, is where the value is being modified.  For
  1421.        example:
  1422.  
  1423.                  A = A + B           <----VALID
  1424.                  17 = A + C          <----INVALID
  1425.  
  1426.        Of course you must specify the correct data type for the ASIC keyword.
  1427.        For example:
  1428.  
  1429.                  A = ABS("HELLO")    <----INVALID
  1430.  
  1431.  
  1432.        This statement is invalid because you cannot take the absolute value
  1433.        of a string!
  1434.  
  1435.        There are a few ASIC statements which will accept only integer
  1436.        constants for some operands (DIM, OPEN, PRINT#, INPUT#).  Refer to the
  1437.        individual statement for more information.
  1438.  
  1439.        Finally, there is a restriction on the use of subscripts for Arrays.
  1440.        A subscript for an array cannot be another array.  For example:
  1441.  
  1442.  
  1443.                  A(I(1))             <----INVALID
  1444.                  A(I)                <----VALID
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458.  
  1459.  
  1460.  
  1461.  
  1462.  
  1463.                                      Page - 22
  1464.  
  1465.  
  1466.  
  1467.  
  1468.  
  1469.  
  1470.  
  1471.  
  1472.  
  1473.                                       A S I C
  1474.  
  1475.                                      Chapter 6
  1476.  
  1477.                                  Keyword Reference
  1478.  
  1479.  
  1480.  
  1481.                                         ABS
  1482.  
  1483.        Format:        integer1 = ABS (integer2)
  1484.  
  1485.        Description:
  1486.  
  1487.             This function returns the absolute value of integer2 which is
  1488.        then stored in integer1.
  1489.  
  1490.        Example:
  1491.  
  1492.                  A = ABS (-7)
  1493.  
  1494.        After execution of this statement, "A" will contain 7.
  1495.  
  1496.  
  1497.  
  1498.                                         ASC
  1499.  
  1500.        Format:        integer1 = ASC (string1)
  1501.  
  1502.        Description:
  1503.  
  1504.             This function returns the ASCII value of the first character of
  1505.        string1, storing the result in integer1.
  1506.  
  1507.        Example:
  1508.  
  1509.                  A = ASC("123")
  1510.  
  1511.        After execution of this statement "A" would contain 49, which the is
  1512.        ASCII value of "1".
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.                                      Page - 23
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.                                         CHR$
  1537.  
  1538.        Format:        string1 = CHR$(integer1)
  1539.  
  1540.        Description:
  1541.  
  1542.             This function converts an integer in the range of 0-255 to an
  1543.        ASCII character, and stores in string1.
  1544.  
  1545.        Example:
  1546.  
  1547.                  A$ = CHR$(49)
  1548.  
  1549.        After execution of this statement, "A$" will contain "1", since "1" is
  1550.        represented by ASCII 49.
  1551.  
  1552.        Comments:
  1553.  
  1554.                  If integer1 is outside the range 0-255, then the least
  1555.        significant byte of integer 1 is converted to string1.
  1556.  
  1557.  
  1558.  
  1559.                                        CLOSE
  1560.  
  1561.        Format:        CLOSE integer1
  1562.  
  1563.        Description:
  1564.  
  1565.             This function closes the file number identified by integer1.  If
  1566.        an error is returned by DOS, the system variable "ERROR" will be > 0.
  1567.  
  1568.        Example:
  1569.  
  1570.                  CLOSE 1
  1571.                  IF ERROR > 0 THEN CHECKERROR:
  1572.  
  1573.        After successful execution of the CLOSE statement, the file previously
  1574.        opened as file 1 will be closed.  If an error is returned by DOS, the
  1575.        ERROR variable will be set by ASIC to a non-zero value.
  1576.  
  1577.        Comments:
  1578.  
  1579.             IF YOU FAIL TO CLOSE AN OPEN FILE (WHICH WAS OPENED FOR WRITING),
  1580.        YOU MAY LOSE DATA, SINCE FILE I/O IS BUFFERED, AND THE LAST BUFFER MAY
  1581.        NOT HAVE BEEN FLUSHED.
  1582.  
  1583.             Also, integer1 may only be a constant with the value of 1-3.
  1584.  
  1585.        See Also:
  1586.  
  1587.             OPEN,PRINT#,INPUT#
  1588.  
  1589.  
  1590.  
  1591.                                      Page - 24
  1592.  
  1593.  
  1594.  
  1595.  
  1596.  
  1597.  
  1598.  
  1599.  
  1600.  
  1601.                                         CLS
  1602.  
  1603.        Format:        CLS
  1604.  
  1605.        Description:
  1606.  
  1607.             This function clears the screen.
  1608.  
  1609.  
  1610.  
  1611.                                        COLOR
  1612.  
  1613.        Format:        COLOR integer1,integer2
  1614.  
  1615.        Description:
  1616.  
  1617.             This function is used to set the foreground and background screen
  1618.        colors.  The foreground color is specified in integer1, the background
  1619.        color in integer2.
  1620.  
  1621.                       Valid Colors:       Foreground       Background
  1622.                                           ----------       ----------
  1623.                       Black                    0              0
  1624.                       Blue                     1              1
  1625.                       Green                    2              2
  1626.                       Cyan                     3              3
  1627.                       Red                      4              4
  1628.                       Magenta                  5              5
  1629.                       Brown                    6              6
  1630.                       White                    7              7
  1631.                       Dark Gray                8
  1632.                       Light Blue               9
  1633.                       Light Green              10
  1634.                       Light Cyan               11
  1635.                       Light Red                12
  1636.                       Light Magenta            13
  1637.                       Yellow                   14
  1638.                       Bright White             15
  1639.  
  1640.                  Note:   Colors 8-15 when specified for background color
  1641.                            result in blinking text.
  1642.  
  1643.        Example:
  1644.  
  1645.                  COLOR 4,8
  1646.  
  1647.        After execution of this statement, future characters written to the
  1648.        screen will be Blinking Red on a Black Background.
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.                                      Page - 25
  1656.  
  1657.  
  1658.  
  1659.  
  1660.  
  1661.  
  1662.  
  1663.  
  1664.  
  1665.                                        CRSLIN
  1666.  
  1667.        Format:        integer1 = CRSLIN
  1668.  
  1669.        Description:
  1670.  
  1671.             This function returns row of the cursor.
  1672.  
  1673.        Example:
  1674.  
  1675.                       LOCATE 10,20
  1676.                       A = CRSLIN
  1677.  
  1678.        The locate command will have positioned the cursor in row 10, column
  1679.        20.  After execution of the CRSLIN statement, "A" will contain the
  1680.        value of 10.
  1681.  
  1682.        See also:
  1683.  
  1684.             POS
  1685.  
  1686.  
  1687.  
  1688.                                        DEFSEG
  1689.  
  1690.        Format:        DEFSEG integer1
  1691.  
  1692.             This function is used the alter the default data segment used
  1693.        when peeking and poking data with PEEK and POKE statements.  DEFSEG,
  1694.        PEEK, and especially POKE are not recommended for beginners.  If
  1695.        integer1 =-1, then the data segment address is set back to the ASIC
  1696.        default data segment address.
  1697.  
  1698.        See also:
  1699.  
  1700.             PEEK, POKE
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.                                      Page - 26
  1720.  
  1721.  
  1722.  
  1723.  
  1724.  
  1725.  
  1726.  
  1727.  
  1728.  
  1729.                                         DIM
  1730.  
  1731.        Format:        DIM variable(integer1)
  1732.  
  1733.  
  1734.        Description:
  1735.  
  1736.             This statement will create one dimensional arrays.  An integer
  1737.        variable name must be specified in variable.  Integer 1 contains the
  1738.        number of elements in the array.
  1739.  
  1740.        Example:
  1741.  
  1742.                  DIM A(10)
  1743.  
  1744.        In this example an array of 10 integer variables is defined.
  1745.  
  1746.        Comments:
  1747.  
  1748.             On the DIM statement, integer1 may only be a constant.  Also, DIM
  1749.        statements must appear before all other statement types in the
  1750.        program.
  1751.  
  1752.  
  1753.  
  1754.                                         END
  1755.  
  1756.        Format:        END
  1757.  
  1758.        Description:
  1759.  
  1760.             This statement causes your program to terminate and return to
  1761.        DOS.
  1762.  
  1763.        Example:
  1764.  
  1765.                  IF PLAYAGAIN$ = "YES" THEN PLAYAGAIN:
  1766.                  END
  1767.  
  1768.        In this example, if the variable PLAYAGAIN$ contains a value other
  1769.        than "YES", then the program will terminate and return to DOS.
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.                                      Page - 27
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.  
  1790.  
  1791.  
  1792.  
  1793.                                       FOR/NEXT
  1794.  
  1795.        Format:        FOR integer1 = integer2 to integer3
  1796.                       NEXT integer1
  1797.  
  1798.        Description:
  1799.  
  1800.             These two statements are used to create a loop, so that you can
  1801.        execute a portion of your program a certain number of times.  All of
  1802.        the code between the FOR and the NEXT statement will be executed a
  1803.        certain number of times, but at least once.  The actual number of
  1804.        times the loop executes is dependent on integer1/integer2/integer3.
  1805.        When the FOR statement is encountered in your program, integer1 is
  1806.        assigned the value of integer2.  Then the statements up to the
  1807.        matching NEXT statement is executed one time.  Then, 1 is added to
  1808.        integer1, and integer1 is compared to integer3.  If integer1 is
  1809.        greater than integer3 then the control passes to the statement
  1810.        following NEXT.  Otherwise, the program loops back up to the statement
  1811.        following the FOR statement.
  1812.  
  1813.        Example:
  1814.  
  1815.                  FOR I = 1 TO 2
  1816.                       FOR J = 3 TO 5
  1817.                            PRINT I;
  1818.                            PRINT J
  1819.                       NEXT J
  1820.                  NEXT I
  1821.                  PRINT "AFTER THE LOOP";
  1822.                  PRINT I;
  1823.                  PRINT J;
  1824.        Execution of this section of code would result in the following
  1825.        printout:
  1826.  
  1827.                  1    3
  1828.                  1    4
  1829.                  1    5
  1830.                  2    3
  1831.                  2    4
  1832.                  2    5
  1833.                  AFTER THE LOOP    3    6
  1834.  
  1835.        Comments:
  1836.  
  1837.             Unlike BASICA/GWBASIC, ASIC FOR/NEXT loops execute at least 1
  1838.        time.  For example, the value "HELLO" will be printed in the following
  1839.        example.  It wouldn't have been in BASICA/GWBASIC.
  1840.  
  1841.                  FOR I = 1 TO 0
  1842.                       PRINT "HELLO"
  1843.                  NEXT I
  1844.  
  1845.  
  1846.  
  1847.                                      Page - 28
  1848.  
  1849.  
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855.  
  1856.  
  1857.                                 FOR/NEXT (Continued)
  1858.  
  1859.             Unlike GWBASIC/BASICA, arrays may be used for integer1 and
  1860.        integer2.  However, if integer3 is an array, element zero will be
  1861.        used, regardless of the subscript you specify.
  1862.  
  1863.             ASIC will allow you to modify the value of integer3, while
  1864.        GWBASIC/BASICA ignores changes.
  1865.  
  1866.                  J=1
  1867.                  FOR I=1 TO J
  1868.                       J=2
  1869.                  NEXT I
  1870.  
  1871.             The above loop will execute one time in GWBASIC/BASICA, but it
  1872.        will execute two times in ASIC.
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.  
  1879.  
  1880.  
  1881.  
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.  
  1911.                                      Page - 29
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.  
  1919.  
  1920.  
  1921.                                        GOSUB
  1922.  
  1923.        Format:        GOSUB label1
  1924.  
  1925.        Description:
  1926.  
  1927.             This statement "calls" a subroutine called "label1".  This
  1928.        subroutine must contain a "RETURN".  After the subroutine is executed,
  1929.        control is returned to the next statement following the GOSUB.
  1930.  
  1931.        Example:
  1932.  
  1933.                  GOSUB PRINTIT:
  1934.                  PRINT "All Done!"
  1935.                  END
  1936.                  PRINTIT:  PRINT "It"
  1937.                  RETURN
  1938.  
  1939.        After execution of this code the screen would contain:
  1940.  
  1941.                  It
  1942.                  All Done!
  1943.  
  1944.  
  1945.  
  1946.                                         GOTO
  1947.  
  1948.        Format:        GOTO label1
  1949.  
  1950.        Description:
  1951.  
  1952.             This statement transfer program execution to the statement
  1953.        identified by label1.
  1954.  
  1955.        Example:
  1956.  
  1957.                  GOTO SKIPIT:
  1958.                  PRINT "YOU'LL NEVER GET HERE"
  1959.                  SKIPIT: PRINT "ALL DONE!"
  1960.  
  1961.        After execution of this code, the screen will appear as follows:
  1962.  
  1963.                  ALL DONE!
  1964.  
  1965.        Note that the first print statement never executes because of the
  1966.        GOTO.
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.                                      Page - 30
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.  
  1985.                                     IF/THEN/ELSE
  1986.  
  1987.        Format:        IF condition THEN label1                  <--Format 1
  1988.                       IF condition THEN label1 ELSE label2      <--Format 2
  1989.  
  1990.        Description:
  1991.  
  1992.             This statement is used to conditionally transfer to a different
  1993.        location in the program. If "condition" is true, control is
  1994.        transferred to label1.  If "condition" is false, if label2 is
  1995.        specified, control transfers to label2, otherwise a false condition
  1996.        will cause the program to continue executing the statement following
  1997.        the IF statement.  The operand "condition" is one of the following:
  1998.  
  1999.                       integer1 > integer2
  2000.                       string1  > string2
  2001.                       integer1 = integer2
  2002.                       string1  = string2
  2003.                       integer1 < integer2
  2004.                       string1  < string2
  2005.  
  2006.        Example:
  2007.  
  2008.                  IF A > 0 THEN APLUS:
  2009.  
  2010.        In this example, if A is greater than zero, the program jumps to the
  2011.        label called "APLUS:".
  2012.  
  2013.        Example:
  2014.  
  2015.                  IF A$="YES" THEN TRUE: ELSE FALSE:
  2016.  
  2017.        In this example, if A$ contains the string "YES", the program jumps to
  2018.        the label called "TRUE:", otherwise the program transfers to label
  2019.        "FALSE:"
  2020.  
  2021.  
  2022.  
  2023.  
  2024.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.                                      Page - 31
  2040.  
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.                                        INKEY$
  2050.  
  2051.        Format:        string1 = INKEY$
  2052.  
  2053.        Description:
  2054.  
  2055.             Used to retrieve keystrokes from the keyboard buffer.  If a
  2056.        character is waiting in the buffer, string1 will be set to the value
  2057.        of that character, and that character will be removed from the
  2058.        keyboard buffer.  If the buffer is empty, string1 will be set to a
  2059.        value of "" (that is, a null string with a length of 0).  If an
  2060.        extended key is pressed (for example the function keys F1 through
  2061.        F10), the system variable EXTENDED will be set to 1 otherwise it will
  2062.        contain 0.
  2063.  
  2064.        Example:
  2065.  
  2066.                  LOOP: X$=INKEY$
  2067.                  IF X$="" THEN LOOP:
  2068.  
  2069.        The above code will cause the program to loop until a key is pressed.
  2070.  
  2071.        Comment:
  2072.  
  2073.             ASIC provides an extension here over BASICA/GWBASIC.  the
  2074.        EXTENDED system variable will allow you to detect special keys as
  2075.        mentioned above.  To do so requires an understanding of keyboard scan
  2076.        codes, which is beyond the scope of this manual.  For more information
  2077.        I would suggest Peter Norton's Programmer's Guide to the IBM PC
  2078.        (Microsoft Press).
  2079.  
  2080.  
  2081.  
  2082.  
  2083.  
  2084.  
  2085.  
  2086.  
  2087.  
  2088.  
  2089.  
  2090.  
  2091.  
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.                                      Page - 32
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.                                        INPUT
  2114.  
  2115.  
  2116.        Format:        INPUT variable1
  2117.  
  2118.        Description:
  2119.  
  2120.             This statement will retrieve a line of text terminated from the
  2121.        input buffer and stores it in variable1.  ASIC will first issue the
  2122.        prompt "?".  It will then wait until the user enters a string or
  2123.        integer and presses the <return> or <enter> key.  The type of data
  2124.        ASIC will expect is dependent on the type of variable1 (integer or
  2125.        string).  If an integer is being entered, ASIC will edit the input for
  2126.        validity as an integer, and if the edit fails will issue another "?"
  2127.        to the user, and will wait for the number to be retyped.  Only when a
  2128.        valid integer has been entered will variable1 be updated, and only
  2129.        then will control return to your ASIC program.
  2130.  
  2131.        Example:
  2132.  
  2133.                  PRINT "Enter a String";
  2134.                  INPUT A$
  2135.  
  2136.        ASIC will issue the prompt:
  2137.  
  2138.                  Enter a String?
  2139.  
  2140.        It will then wait until you enter a string or press enter.  If you
  2141.        pressed enter with no characters A$ would contain "" (ie its length
  2142.        would equal 0), otherwise A$ would contain the string entered.
  2143.  
  2144.        Example:
  2145.  
  2146.                  INPUT I
  2147.  
  2148.        In this example ASIC will issue the prompt:
  2149.  
  2150.                  ?
  2151.  
  2152.        ASIC will then wait for you to enter a valid number.  If you enter an
  2153.        invalid number, say "x", ASIC will reissue the "?" prompt and wait for
  2154.        you to retype your input.  Once the input has been edited by ASIC, "I"
  2155.        would contain the number entered.
  2156.  
  2157.        See Also:
  2158.  
  2159.             INKEY$
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.                                      Page - 33
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.                                        INPUT#
  2178.  
  2179.        Format:        INPUT# integer1, variable1
  2180.  
  2181.        Description:
  2182.  
  2183.             This statement will read a variable file a file identified by
  2184.        file number integer1.  It will be stored in variable1.  If an error
  2185.        occurs during the read, the system variable ERROR will be set to a
  2186.        non-zero value.  The possible errors are listed in the error messages
  2187.        section of this manual.  If you read a file past it's end, the
  2188.        contents of variable1 are undefined.
  2189.  
  2190.        Example:
  2191.  
  2192.             INPUT#1, A$
  2193.             IF ERROR=99 THEN ENDOFFILE:
  2194.  
  2195.        In this example, a string will be read from file #1, and it will be
  2196.        stored in A$.  The system ERROR variable is then checked to see if End
  2197.        of file was reached.  Note, other ERRORS could also be returned by
  2198.        INPUT#, besides error code 99.  Refer to the error messages section
  2199.        for more information.
  2200.  
  2201.        Comments:
  2202.  
  2203.             Note that integer1 must be a constant in the range of 1-3.  It
  2204.        identifies a file by file number which must have previously been
  2205.        opened by an OPEN command.
  2206.  
  2207.          Note that ASIC assumes that integers will be stored in files in 2-
  2208.        byte binary format, which is the format ASIC writes integers.
  2209.        Consequently, If a file contained a string "123", but you told ASIC to
  2210.        read integer "X", then ASIC would read two bytes from the file and
  2211.        interpret "12" as two binary bytes that it would then combine and
  2212.        store as "X".  "X" would contain the integer value 12849.  Thus to
  2213.        read an integer correctly, you will have had to previously written it
  2214.        with an ASIC program.
  2215.  
  2216.        See Also:
  2217.  
  2218.             OPEN, CLOSE, PRINT#
  2219.  
  2220.  
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.                                      Page - 34
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.                                         LEN
  2242.  
  2243.        Format:        integer1 = LEN (string1)
  2244.  
  2245.        Description:
  2246.  
  2247.             This statement returns the length (number of characters) of a
  2248.        string, and stores the length in integer1.
  2249.  
  2250.        Example:
  2251.  
  2252.                  A$="abc"
  2253.                  LENGTH1 = LEN(A$)
  2254.  
  2255.        After execution of these statements, LENGTH1 would contain 3.
  2256.  
  2257.  
  2258.  
  2259.                                        LOCATE
  2260.  
  2261.        Format:        LOCATE row,column
  2262.  
  2263.        Description:
  2264.  
  2265.             This statement is used to position the cursor to a row and
  2266.        column.  Row and Column should be integers.  Row has the range 1-25,
  2267.        Column has the range 1-80.  This function does not perform edits on
  2268.        the ranges of row and column.  Consequently using this function with
  2269.        values outside these ranges will have unpredictable results.
  2270.  
  2271.        Example:
  2272.  
  2273.                  LOCATE 10,20
  2274.                  PRINT "HELLO"
  2275.  
  2276.        After execution of these statements, the message "HELLO" will appear
  2277.        beginning at row 10, column 20.
  2278.  
  2279.  
  2280.  
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.                                      Page - 35
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.                                        LPRINT
  2306.  
  2307.        Format:        LPRINT printobject [;]
  2308.  
  2309.        Description:
  2310.  
  2311.             This statement is used to send the contents of printobject to an
  2312.        attached printer.  "printobject" can be any valid ASIC datatype:
  2313.        integer constant, integer number, string constant, string variable,
  2314.        and also array elements.  Optionally, a ";" can be included with this
  2315.        statement to suppress a carriage return/line feed which ASIC normally
  2316.        also sends to the printer following each LPRINT.  This can be used to
  2317.        string several printobjects together on a single print line.
  2318.  
  2319.        Example:
  2320.  
  2321.                  A=12345
  2322.                  LPRINT "The value of A is: ";
  2323.                  LPRINT A
  2324.  
  2325.        After execution of these statements the printer would print:
  2326.  
  2327.                  The value of A is: 12345
  2328.  
  2329.        Comments:
  2330.  
  2331.                  Note that if the printer is not "online" that DOS will issue
  2332.        a message to "Abort, Retry, or Ignore".  This could overwrite a
  2333.        portion of the program display, unless not planned for.
  2334.  
  2335.                  Note also, that some printers do not begin printing until
  2336.        they receive a carriage return/line feed sequence.
  2337.  
  2338.  
  2339.  
  2340.  
  2341.  
  2342.  
  2343.  
  2344.  
  2345.  
  2346.  
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.                                      Page - 36
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.                                         MID$
  2370.  
  2371.        Format:        string1 = MID$(string2,integer1,integer2)
  2372.  
  2373.        Description:
  2374.  
  2375.             This statement is used to extract a substring from string2
  2376.        beginning at position integer1 within string2 and continuing for
  2377.        integer2 bytes.  This value is then stored in string1.
  2378.  
  2379.        Example:
  2380.  
  2381.                       A$="THE QUICK BROWN FOX"
  2382.                       B$=MID$(A$,1,4)
  2383.                       C$=MID$(A$,11,9)
  2384.                       D$=B$ + C$
  2385.  
  2386.        After execution of these statements, the contents of A$ will be
  2387.        unchanged.  The contents of B$ will be "THE ".  The contents of C$
  2388.        will be "BROWN FOX", and the contents of D$ will be "THE BROWN FOX".
  2389.  
  2390.  
  2391.  
  2392.                                         OPEN
  2393.  
  2394.        Format:        OPEN string1, integer1, string2
  2395.  
  2396.        Description:
  2397.  
  2398.             This statement is used to open a file for input or output.  Up to
  2399.        three files may be open concurrently, these are known as file 1, 2, or
  2400.        3.  You must specify with integer1 which file number you wish to open
  2401.        this file as.  Integer1 may only be a constant.  The file mode is
  2402.        specified in string1.  The valid values are "I" for INPUT and "O" for
  2403.        OUTPUT.  The file name is specified with string2.  Any errors returned
  2404.        from DOS on the OPEN call will be returned in the system variable
  2405.        "ERROR".
  2406.  
  2407.        Example:
  2408.  
  2409.                  A$="INFILE"
  2410.                  OPEN "I",3,A$
  2411.                  IF ERROR > 0 THEN PROCESSERROR:
  2412.                  OPEN "O",1,"A:\NEWFILE.DAT"
  2413.                  IF ERROR > 0 THEN PROCESSERROR:
  2414.  
  2415.        In this example, two files are opened.  File "INFILE" from the current
  2416.        disk drive and directory will be opened as file number 3 for input.
  2417.        The file "A:\NEWFILE.DAT" will be opened for output as file number 1.
  2418.        Note that if "A:\NEWFILE.DAT" previously existed, it contents will be
  2419.        destroyed in preparation for writing.
  2420.  
  2421.  
  2422.  
  2423.                                      Page - 37
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.                                         PEEK
  2434.  
  2435.        Format:        integer1 = PEEK (integer2)
  2436.  
  2437.        Description:
  2438.  
  2439.             This statement is used to examine actual memory location values
  2440.        directly.  By default, the ASIC DS address is assumed.  However, this
  2441.        may be overridden with the use of the DEFSEG command.  The value of
  2442.        the byte at address integer2 is stored in integer1.
  2443.  
  2444.        See also:
  2445.  
  2446.             DEFSEG, POKE
  2447.  
  2448.  
  2449.  
  2450.                                        POINT
  2451.  
  2452.        Format:        integer1 = POINT (integer2,integer3)
  2453.  
  2454.        Description:
  2455.  
  2456.             This statement is used to determine the color of a given pixel in
  2457.        medium and high resolution graphics modes.  The row to test is
  2458.        specified with integer2, the column with integer3.  The color of the
  2459.        pixel is stored in integer1.
  2460.  
  2461.        Example:
  2462.  
  2463.                  PCOLOR = POINT (10,20)
  2464.  
  2465.        After execution of this statement, PCOLOR will contain the color of
  2466.        the pixel in row 10 column 20.
  2467.  
  2468.        Comments:
  2469.  
  2470.             No range checking is performed on row and column.  If the
  2471.        specified row or column is outside the valid range for the given
  2472.        graphics mode, the results are unpredictable.
  2473.  
  2474.        See also:
  2475.  
  2476.             PSET, PRESET, SCREEN
  2477.  
  2478.  
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.                                      Page - 38
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.                                         POKE
  2498.  
  2499.        Format:        POKE integer1, integer2
  2500.  
  2501.        Description:
  2502.  
  2503.             This instruction is used store the byte value integer2 at the
  2504.        memory address specified by integer1.  By default, ASIC uses it's
  2505.        default data segment address, however, this may be overridden with the
  2506.        DEFSEG statement.
  2507.  
  2508.        Comments:
  2509.  
  2510.             This statement is NOT RECOMMENDED FOR BEGINNERS.  Directly
  2511.        overwriting memory locations can be disastrous, unless you know what
  2512.        is stored at that address.  This can cause program "hangs", system
  2513.        crashes, etc.
  2514.  
  2515.        See also:
  2516.  
  2517.             DEFSEG, PEEK
  2518.  
  2519.  
  2520.  
  2521.                                         POS
  2522.  
  2523.        Format:        integer1 = POS (integer2)
  2524.  
  2525.        Description:
  2526.  
  2527.             This statement finds the column number of the cursor and stores
  2528.        it in integer1.  integer2 is a dummy argument included only because a
  2529.        dummy argument is required in BASICA/GWBASIC.
  2530.  
  2531.        Example:
  2532.  
  2533.                  A = POS(0)
  2534.  
  2535.        After this statement executes, A will contain the column number of the
  2536.        cursor.
  2537.  
  2538.        See also:
  2539.  
  2540.             CRSLIN
  2541.  
  2542.  
  2543.  
  2544.  
  2545.  
  2546.  
  2547.  
  2548.  
  2549.  
  2550.  
  2551.                                      Page - 39
  2552.  
  2553.  
  2554.  
  2555.  
  2556.  
  2557.  
  2558.  
  2559.  
  2560.  
  2561.                                        PRESET
  2562.  
  2563.        Format:        PRESET (integer1,integer2)
  2564.  
  2565.        Description:
  2566.  
  2567.             This statement is used to set the color of a pixel to the
  2568.        background color. The row of the pixel is specified in integer1, and
  2569.        the column is specified in integer2.  This statement only works in
  2570.        medium and high resolution graphics modes.
  2571.  
  2572.        Example:
  2573.  
  2574.                  PRESET (10,20)
  2575.  
  2576.        The pixel at row 10 column 20 would be set to the background color.
  2577.  
  2578.        See also:
  2579.  
  2580.             PSET, SCREEN, POINT
  2581.  
  2582.  
  2583.  
  2584.  
  2585.  
  2586.  
  2587.  
  2588.  
  2589.  
  2590.  
  2591.  
  2592.  
  2593.  
  2594.  
  2595.  
  2596.  
  2597.  
  2598.  
  2599.  
  2600.  
  2601.  
  2602.  
  2603.  
  2604.  
  2605.  
  2606.  
  2607.  
  2608.  
  2609.  
  2610.  
  2611.  
  2612.  
  2613.  
  2614.  
  2615.                                      Page - 40
  2616.  
  2617.  
  2618.  
  2619.  
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625.                                        PRINT
  2626.  
  2627.        Format:        PRINT printobject1 [;]
  2628.  
  2629.        Description:
  2630.  
  2631.             This statement is used to print to the screen.  Printing begins
  2632.        at the current cursor location.  Printobject1 is defined as any valid
  2633.        ASIC data type:  integer constant, integer variable, string constant,
  2634.        string variable, and arrays.  The semicolon is optional and is used to
  2635.        tell ASIC if you want a carriage return/line feed issued.  A semicolon
  2636.        at the end of a PRINT statement will suppress the carriage return/line
  2637.        feed ASIC normally issues.
  2638.  
  2639.        Example:
  2640.  
  2641.                  A=1000
  2642.                  PRINT "A=";
  2643.                  PRINT A
  2644.                  PRINT "DONE!"
  2645.  
  2646.        After execution of these statements your screen would display:
  2647.  
  2648.                  A=  1000
  2649.                  DONE!
  2650.  
  2651.  
  2652.        See also:
  2653.  
  2654.             COLOR, SCREEN, LOCATE
  2655.  
  2656.  
  2657.  
  2658.  
  2659.  
  2660.  
  2661.  
  2662.  
  2663.  
  2664.  
  2665.  
  2666.  
  2667.  
  2668.  
  2669.  
  2670.  
  2671.  
  2672.  
  2673.  
  2674.  
  2675.  
  2676.  
  2677.  
  2678.  
  2679.                                      Page - 41
  2680.  
  2681.  
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.                                        PRINT#
  2690.  
  2691.        Format:        PRINT# integer1, printobject1
  2692.  
  2693.        Description:
  2694.  
  2695.             This statement is used to write integers and strings to disk.
  2696.        integer1 identifies the file number that the file was opened as.  The
  2697.        file number, and thus integer1  must be 1, 2 or 3.  integer1 must be
  2698.        an integer constant.  The file must have been previously opened with
  2699.        the OPEN command.  DOS errors are returned in the system variable
  2700.        "ERROR".  A list of these error codes may be found in the error
  2701.        messages section of this manual.  Also, refer to the technical details
  2702.        section of this manual for more information on the format in which
  2703.        ASIC writes the data to disk.
  2704.  
  2705.        Example:
  2706.  
  2707.                  PRINT# 1, "HELLO"
  2708.                  IF ERROR = 255 THEN DISKFULL:
  2709.                  PRINT# 2, "WORLD"
  2710.                  IF ERROR = 255 THEN DISKFULL:
  2711.  
  2712.        After successful execution of the print statement the file identified
  2713.        by file number 1 would contain "HELLO0WORLD0" . Note that the "0"
  2714.        following HELLO and WORLD in our example represents the ASCII null
  2715.        character.  Strings in ASIC are always internally terminated with
  2716.        ASCII null characters.
  2717.  
  2718.        Comments:
  2719.  
  2720.          Note that while ASIC doesn't generate carriage returns and line
  2721.        feeds for you as it does with the PRINT command, you can write these
  2722.        characters to disk as follows:
  2723.  
  2724.                  A$="HELLO"
  2725.                  B$=CHR$(13)
  2726.                  A$ = A$ + B$
  2727.                  B$=CHR$(11)
  2728.                  A$ = A$ + b$
  2729.  
  2730.        See also:
  2731.  
  2732.                  OPEN, CLOSE, INPUT#
  2733.  
  2734.  
  2735.  
  2736.  
  2737.  
  2738.  
  2739.  
  2740.  
  2741.  
  2742.  
  2743.                                      Page - 42
  2744.  
  2745.  
  2746.  
  2747.  
  2748.  
  2749.  
  2750.  
  2751.  
  2752.  
  2753.                                         PSET
  2754.  
  2755.        Format:        PSET (integer1,integer2),integer3
  2756.  
  2757.        Description:
  2758.  
  2759.             This statement is used to set a pixel to a specified color in
  2760.        medium and high resolution graphics modes.  The row is specified in
  2761.        integer1, the column in integer2, and the color in integer3.  Note
  2762.        that no range checking is performed on integer1 or integer2.  A row or
  2763.        column specified outside the range allowed by the graphics mode in use
  2764.        can result in unpredictable results.
  2765.  
  2766.        Example:
  2767.  
  2768.                  PSET (10,20),1
  2769.  
  2770.        In this example the pixel defined at row 10 and column 20 will be set
  2771.        to color 1.
  2772.  
  2773.        See also:
  2774.  
  2775.             PRESET, SCREEN, POINT
  2776.  
  2777.  
  2778.  
  2779.  
  2780.  
  2781.  
  2782.  
  2783.  
  2784.  
  2785.  
  2786.  
  2787.  
  2788.  
  2789.  
  2790.  
  2791.  
  2792.  
  2793.  
  2794.  
  2795.  
  2796.  
  2797.  
  2798.  
  2799.  
  2800.  
  2801.  
  2802.  
  2803.  
  2804.  
  2805.  
  2806.  
  2807.                                      Page - 43
  2808.  
  2809.  
  2810.  
  2811.  
  2812.  
  2813.  
  2814.  
  2815.  
  2816.  
  2817.                                      RANDOMIZE
  2818.  
  2819.        Format:        RANDOMIZE
  2820.  
  2821.        Description:
  2822.  
  2823.                  This statement will cause the seed for the random number
  2824.        generator to be reseeded using the system timer.  This statement
  2825.        should always precede the first RND statement in your program, unless
  2826.        you want the same sequence of random numbers generated.
  2827.  
  2828.        See also:
  2829.  
  2830.             RND
  2831.  
  2832.  
  2833.  
  2834.                                         REM
  2835.  
  2836.        Format:    REM  free form comments
  2837.  
  2838.        Description:
  2839.  
  2840.             This statement is used to insert comments into your program.
  2841.        Everything following REM is treated by ASIC as a comment.
  2842.  
  2843.  
  2844.  
  2845.                                        RETURN
  2846.  
  2847.        Format:        RETURN
  2848.  
  2849.        Description:
  2850.  
  2851.             Used to return from a GOSUB call.
  2852.  
  2853.        Comments:
  2854.  
  2855.             Executing a RETURN statement without having first executed a
  2856.        GOSUB statement could cause unpredictable results.
  2857.  
  2858.        See also:
  2859.  
  2860.             GOSUB
  2861.  
  2862.  
  2863.  
  2864.  
  2865.  
  2866.  
  2867.  
  2868.  
  2869.  
  2870.  
  2871.                                      Page - 44
  2872.  
  2873.  
  2874.  
  2875.  
  2876.  
  2877.  
  2878.  
  2879.  
  2880.  
  2881.                                         RND
  2882.  
  2883.        Format:        integer1 = RND (integer2)
  2884.  
  2885.        Description:
  2886.  
  2887.             This statement will return an integer number in the range of 0
  2888.        through 32767 and store it in integer1.  Integer2 is a dummy argument
  2889.        and can be any valid integer value.
  2890.  
  2891.        Example:
  2892.  
  2893.                  A = RND(0)
  2894.  
  2895.        After execution of this statement "A" will contain a number between 0
  2896.        and 32767 inclusive.
  2897.  
  2898.        Comments:
  2899.  
  2900.             In BASICA/GWBASIC, RND always returns a value between 1 and 0,
  2901.        however, since ASIC only operates with integer values, having the
  2902.        random number function only return two values seemed ridiculous.
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908.  
  2909.  
  2910.  
  2911.  
  2912.  
  2913.  
  2914.  
  2915.  
  2916.  
  2917.  
  2918.  
  2919.  
  2920.  
  2921.  
  2922.  
  2923.  
  2924.  
  2925.  
  2926.  
  2927.  
  2928.  
  2929.  
  2930.  
  2931.  
  2932.  
  2933.  
  2934.  
  2935.                                      Page - 45
  2936.  
  2937.  
  2938.  
  2939.  
  2940.  
  2941.  
  2942.  
  2943.  
  2944.  
  2945.                                        SCREEN
  2946.  
  2947.        Format:        SCREEN integer1
  2948.  
  2949.        Description:
  2950.  
  2951.             This statement will transfer the computer from text mode to
  2952.        medium and high resolution graphics modes.  integer1 must be an
  2953.        integer constant with a value of 0,1 or 2.  Screen mode 0 is 25 lines
  2954.        by 80 columns text with 16 colors.  Screen mode 1 is medium resolution
  2955.        graphics mode with 25 lines by 40 columns text, or 200 rows by 320
  2956.        columns of pixels with four colors.  Screen mode 2 is high resolution
  2957.        graphics mode with 25 lines by 80 columns of text, or 200 rows by 640
  2958.        columns of pixels with two colors (black and white).
  2959.  
  2960.        Example:
  2961.  
  2962.                  SCREEN 1
  2963.  
  2964.        After execution of this statement, the screen will be in medium
  2965.        resolution graphics mode.
  2966.  
  2967.  
  2968.        Comments:
  2969.  
  2970.             Any program which uses the two graphics modes (1 and 2) should
  2971.        issue a "SCREEN 0" command before terminating.  Otherwise, the screen
  2972.        will be left in 25x40 character graphics mode which is very irritating
  2973.        under DOS.
  2974.  
  2975.        See also:
  2976.  
  2977.             PSET, PRESET, POINT
  2978.  
  2979.  
  2980.  
  2981.  
  2982.  
  2983.  
  2984.  
  2985.  
  2986.  
  2987.  
  2988.  
  2989.  
  2990.  
  2991.  
  2992.  
  2993.  
  2994.  
  2995.  
  2996.  
  2997.  
  2998.  
  2999.                                      Page - 46
  3000.  
  3001.  
  3002.  
  3003.  
  3004.  
  3005.  
  3006.  
  3007.  
  3008.  
  3009.                                        SOUND
  3010.  
  3011.        Format:        SOUND integer1,integer2
  3012.  
  3013.        Description:
  3014.  
  3015.             This statement will generate a sound on your computer speaker
  3016.        with a frequency of integer1, and a duration of integer2.  Frequency
  3017.        is in Hertz and should be in the range of 0 to 32767.  ASIC, however,
  3018.        only checks to see that it is non-negative.
  3019.  
  3020.        Example:
  3021.  
  3022.                  SOUND  400,20
  3023.  
  3024.        Execution of the above statement will produce a short beep.
  3025.  
  3026.  
  3027.  
  3028.                                         STR$
  3029.  
  3030.        Format:        string1 = STR$ (integer1)
  3031.  
  3032.        Description:
  3033.  
  3034.             This statement will convert integer1 to a string format and store
  3035.        the string format in string1.
  3036.  
  3037.        Example:
  3038.  
  3039.                  A=1234
  3040.                  A$ = STR$(A)
  3041.  
  3042.        After execution of these statements, A$ would contain the string
  3043.        "1234".
  3044.  
  3045.        See also:
  3046.  
  3047.             VAL
  3048.  
  3049.  
  3050.  
  3051.  
  3052.  
  3053.  
  3054.  
  3055.  
  3056.  
  3057.  
  3058.  
  3059.  
  3060.  
  3061.  
  3062.  
  3063.                                      Page - 47
  3064.  
  3065.  
  3066.  
  3067.  
  3068.  
  3069.  
  3070.  
  3071.  
  3072.  
  3073.                                         VAL
  3074.  
  3075.        Format:        integer1 = VAL (string1)
  3076.  
  3077.        Description:
  3078.  
  3079.             This statement will attempt to convert string1 into an integer
  3080.        value, and it will store the result in integer1.
  3081.  
  3082.        Example:
  3083.  
  3084.                  A$ = "12345"
  3085.                  A = VAL (A$)
  3086.  
  3087.        After execution of these statements, variable "A" would contain the
  3088.        value 12345.
  3089.  
  3090.  
  3091.        See also:
  3092.  
  3093.             STR$
  3094.  
  3095.  
  3096.  
  3097.                                        VARPTR
  3098.  
  3099.        Format:        integer1 = VARPTR (variable1)
  3100.  
  3101.        Description:
  3102.  
  3103.             This statement will return the address of a variable  variable1
  3104.        and store it in integer1.  This may be used to peek and poke values
  3105.        directly into a variable.
  3106.  
  3107.        Example:
  3108.  
  3109.                  A$ = "XYZ"
  3110.                  B = VARPTR(A$)
  3111.                  C = PEEK (B)
  3112.                  PRINT C
  3113.  
  3114.        After execution of these statements the screen would display the
  3115.        number 88 which is the number for the ASCII character "X".
  3116.  
  3117.        See also:
  3118.  
  3119.             PEEK, POKE
  3120.  
  3121.  
  3122.  
  3123.  
  3124.  
  3125.  
  3126.  
  3127.                                      Page - 48
  3128.  
  3129.  
  3130.  
  3131.  
  3132.  
  3133.  
  3134.  
  3135.  
  3136.  
  3137.                                        WIDTH
  3138.  
  3139.        Format:        WIDTH integer1
  3140.  
  3141.        Description:
  3142.  
  3143.             This statement will set the screen to 40 column text or 80 column
  3144.        text mode only.  The only two valid values for integer1 are thus 40
  3145.        and 80.  In ASIC, WIDTH 80 is equivalent to executing SCREEN 0.  Also,
  3146.        WIDTH 40 is equivalent to executing SCREEN 1.  If you use WIDTH 40,
  3147.        you should always reset the screen back to WIDTH 80 before terminating
  3148.        your program with END.  Otherwise, your PC will be left in 40 column
  3149.        mode.
  3150.  
  3151.  
  3152.  
  3153.                                        ZMODE
  3154.  
  3155.        Format:        integer = ZMODE
  3156.  
  3157.        Description:
  3158.  
  3159.             This command returns a code which indicates whether a color or
  3160.        monochrome card is active in the system.  ZMODE returns a value of 1
  3161.        when a color card is detected, and a value of 0 for monochrome.
  3162.  
  3163.        Example:
  3164.  
  3165.                  A = ZMODE
  3166.                  IF A = 1 THEN CONTINUE:
  3167.                  PRINT "This program requires a Color Card to Run"
  3168.                  END
  3169.                  CONTINUE: REM rest of code follows here
  3170.  
  3171.        The above code fragment will check for a color card, if not found the
  3172.        program will terminate with an appropriate message.  Otherwise the
  3173.        program will continue.
  3174.  
  3175.        Comments:
  3176.  
  3177.             This statement is an extension over BASICA/GWBASIC.
  3178.  
  3179.  
  3180.  
  3181.  
  3182.  
  3183.  
  3184.  
  3185.  
  3186.  
  3187.  
  3188.  
  3189.  
  3190.  
  3191.                                      Page - 49
  3192.  
  3193.  
  3194.  
  3195.  
  3196.  
  3197.  
  3198.  
  3199.  
  3200.  
  3201.                                       A S I C
  3202.  
  3203.                                      Chapter 7
  3204.  
  3205.                          Compatibility with GWBASIC/BASICA
  3206.  
  3207.  
  3208.        In general, although ASIC does not support all options on every BASIC
  3209.        statement, those it does support work like they do in BASICA/GWBASIC.
  3210.        The known exceptions are listed in this chapter.
  3211.  
  3212.  
  3213.  
  3214.        INKEY$
  3215.  
  3216.             This statement is compatible, however ASIC does provide an
  3217.        extension over GWBASIC/BASICA.  If an extended key is pressed (e.g.
  3218.        F1-F10), ASIC returns the scan code for the extended key, and sets a
  3219.        special system variable "EXTENDED" to a value of 1.  For non-extended
  3220.        keys, the "EXTENDED" variable will contain 0.
  3221.  
  3222.  
  3223.        FILE HANDLING
  3224.  
  3225.             ASIC provides no EOF statement or ON ERROR statements.  Instead,
  3226.        ASIC sets a special system variable when an error occurs during file
  3227.        I/O.  This special variable is called "ERROR" and it is set after
  3228.        every file I/O statement (OPEN/INPUT#/PRINT#/CLOSE) to either 0 to
  3229.        indicate no errors, or a non-zero value.  If a non-zero value is
  3230.        present, an error has occurred.  The specific errors are identified in
  3231.        chapter 9.
  3232.  
  3233.  
  3234.        FILE FORMAT
  3235.  
  3236.             ASIC Files are written with 2 bytes per integer in binary format,
  3237.        instead of string format as in BASICA/GWBASIC.  Strings are written as
  3238.        a sequence of ASCII characters terminated by an ASCII null.
  3239.  
  3240.  
  3241.  
  3242.  
  3243.  
  3244.  
  3245.  
  3246.  
  3247.  
  3248.  
  3249.  
  3250.  
  3251.  
  3252.  
  3253.  
  3254.  
  3255.                                      Page - 50
  3256.  
  3257.  
  3258.  
  3259.  
  3260.  
  3261.  
  3262.  
  3263.  
  3264.        PUNCTUATION
  3265.  
  3266.             ASIC permits use of punctuation that it does not require to allow
  3267.        you to enter statements in their familiar GWBASIC/BASICA Formats.  For
  3268.        example:
  3269.  
  3270.                  A = ABS (B(1))
  3271.  
  3272.             This statement is valid in both ASIC and in GWBASIC/BASICA.
  3273.        However, ASIC ignores the parenthesis and comma.  Thus ASIC will
  3274.        actually accept the following formats as alternatives to the above:
  3275.  
  3276.             A = ABS B 1
  3277.             A = ABS B 1,,,,,,)))))
  3278.  
  3279.  
  3280.  
  3281.        FOR/NEXT
  3282.  
  3283.             FOR/NEXT loops always fall through the body of the FOR at least
  3284.        one time in ASIC.  This does not happen in BASICA/GWBASIC.  For more
  3285.        information on this, refer to Chapter 6.
  3286.  
  3287.  
  3288.        RND
  3289.  
  3290.             RND (N) returns a value from 0-32767 inclusive instead of 0 to 1
  3291.        as in BASICA/GWBASIC.
  3292.  
  3293.  
  3294.        ZMODE
  3295.  
  3296.             ZMODE is an extension over BASICA/GWBASIC.  It returns a code
  3297.        which the program can check to determine if the PC contains a color or
  3298.        monochrome display adapter card.
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.  
  3305.  
  3306.  
  3307.  
  3308.  
  3309.  
  3310.  
  3311.  
  3312.  
  3313.  
  3314.  
  3315.  
  3316.  
  3317.  
  3318.  
  3319.                                      Page - 51
  3320.  
  3321.  
  3322.  
  3323.  
  3324.  
  3325.  
  3326.  
  3327.  
  3328.  
  3329.                                       A S I C
  3330.  
  3331.                                      Chapter 8
  3332.  
  3333.                                Technical Details/Tips
  3334.  
  3335.  
  3336.        This chapter contains technical information and tips regarding the
  3337.        ASIC compiler.
  3338.  
  3339.  
  3340.  
  3341.                                   COMPILER LIMITS
  3342.  
  3343.  
  3344.        Maximum Source Program Size:   Unlimited - Command Line
  3345.                                       809 Lines - Integrated Environment
  3346.  
  3347.        Maximum Object Program Size:   64k bytes  (.COM Format restriction)
  3348.  
  3349.        Maximum Source Line Length     128 bytes - Command Line
  3350.                                       80 bytes - Integrated Environment
  3351.  
  3352.        Compiler Symbol Table Size:    750+ Symbols
  3353.  
  3354.        Maximum Number of Arrays:      25
  3355.  
  3356.        FOR/NEXT Nesting Depth         25
  3357.  
  3358.        Compiler Memory Requirements   320k - Command Line
  3359.                                       400k - Integrated Environment
  3360.  
  3361.  
  3362.  
  3363.                                  COMPILER OPERATION
  3364.  
  3365.  
  3366.             ASIC is a single pass compiler written entirely in C (Borland
  3367.        Turbo C Version 2.0).  Each source statement is translated directly
  3368.        into machine code.  ASIC compiles 100% in memory for maximum speed.
  3369.        The compiler does not require any disk work space.  ASIC generates a
  3370.        minimum of error checking code.  This is because the ASIC philosophy
  3371.        stresses execution speed.  This does place greater responsibility on
  3372.        the programmer to check for out of bounds conditions, etc..
  3373.  
  3374.  
  3375.  
  3376.  
  3377.  
  3378.  
  3379.  
  3380.  
  3381.  
  3382.  
  3383.                                      Page - 52
  3384.  
  3385.  
  3386.  
  3387.  
  3388.  
  3389.  
  3390.  
  3391.  
  3392.  
  3393.                                   STORAGE FORMATS
  3394.  
  3395.  
  3396.        Integers are stored in ASIC as two bytes, with the low order byte
  3397.        appearing first (as per Intel conventions).  String variables are
  3398.        stored as FIXED 80 character strings terminated by an ASCII null
  3399.        character for a total length of 81 characters.  String constants are
  3400.        stored with 1 byte per character in the string followed by a
  3401.        terminating ASCII null character.  Each element in an array requires
  3402.        two bytes.  (Don't forget arrays have an element zero (ie  DIM A(2) is
  3403.        comprised of A(0), A(1), and A(2)).
  3404.  
  3405.        Examples:
  3406.  
  3407.                  Item        Data Type              Storage Requirements
  3408.                    A         Integer Variable            2 bytes
  3409.                    17        Integer Constant            2 bytes
  3410.                   A$         String Variable             81 bytes
  3411.                   "ABC"      String Constant             4 bytes
  3412.                   "A"        String Constant             2 bytes
  3413.                  DIM A(10)   Integer Array               22 bytes
  3414.                  DIM A(1)    Integer Array               4 bytes
  3415.  
  3416.        As you can see, string variables are expensive in terms of storage
  3417.        space.  Since string constants are stored at actual length +1, It is
  3418.        MUCH more efficient to store short strings as constants in ASIC in
  3419.        terms of storage space.  There is no performance advantage to
  3420.        constants over variables, however.
  3421.  
  3422.        In disk files, strings and integers are written out in the above
  3423.        formats.  Note that unlike GWBASIC/BASICA, integers are NOT expanded
  3424.        into strings when written, and conversely, not converted from strings
  3425.        to integers when read.  String variables and constants are written out
  3426.        as ASCII strings terminated by a null character.  Thus, string
  3427.        variables when written to disk, take the same space byte for byte as
  3428.        string constants.
  3429.  
  3430.        The reason behind fixed length string variables was avoidance of
  3431.        string "garbage collection".  In addition to slight performance
  3432.        advantages, there is the added benefit of providing a string memory
  3433.        address which never changes.  Thus once VARPTR retrieves the address
  3434.        of a variable, you never have to worry about it changing.
  3435.  
  3436.  
  3437.  
  3438.  
  3439.  
  3440.  
  3441.  
  3442.  
  3443.  
  3444.  
  3445.  
  3446.  
  3447.                                      Page - 53
  3448.  
  3449.  
  3450.  
  3451.  
  3452.  
  3453.  
  3454.  
  3455.  
  3456.  
  3457.                                      MEMORY MAP
  3458.  
  3459.        The following describes the structure of the ".COM" file created by
  3460.        ASIC.  All addresses are in Hexadecimal.
  3461.  
  3462.  
  3463.  
  3464.             Description                   Address Range
  3465.        ------------------------------     -------------
  3466.        Program Segment Prefix (PSP)       0000 - 00FF
  3467.         (Created/Required by DOS)
  3468.  
  3469.        Transfer to Program Code           0100 - 0102
  3470.        String Conversion Buffer           0103 - 0109
  3471.        Input Buffer                       010A - 015B
  3472.        Screen Width                       015C
  3473.        Color/Attribute Byte               015D
  3474.        Screen Graphics Mode               015E
  3475.        Cursor Position                    015F - 0160
  3476.        File Control Table                 0161 - 0169
  3477.        ERROR System Variable              016A - 016B
  3478.        System Subroutine Vectors          016C - 017F
  3479.        EXTENDED System Variable           0180 - 0181
  3480.        RND Seed                           0182 - 0185
  3481.        Math Work Area                     0186 - 018D
  3482.        DEFSEG System Variable             018E - 018F
  3483.        System Subroutines                 0190+
  3484.                  |
  3485.                  |
  3486.                  v
  3487.        Data Segment                       Address Varies
  3488.                  |
  3489.                  |
  3490.                  |
  3491.                  v
  3492.        Code Segment                       Address Varies
  3493.                  |
  3494.                  |
  3495.                  |
  3496.                  v
  3497.                  ^
  3498.                  |
  3499.                  |
  3500.        Program Stack  (builds downward)   FFFF
  3501.  
  3502.  
  3503.  
  3504.  
  3505.  
  3506.  
  3507.  
  3508.  
  3509.  
  3510.  
  3511.                                      Page - 54
  3512.  
  3513.  
  3514.  
  3515.  
  3516.  
  3517.  
  3518.  
  3519.  
  3520.  
  3521.                                       A S I C
  3522.  
  3523.                                      Chapter 9
  3524.  
  3525.                                    Error Messages
  3526.  
  3527.  
  3528.        This chapter contains compiler messages, run-time error messages, and
  3529.        File I/O Error Codes.
  3530.  
  3531.  
  3532.  
  3533.                                   COMPILER ERRORS
  3534.  
  3535.  
  3536.  
  3537.             These messages indicate errors in your source program.  Those
  3538.        which begin with "** E" indicate "fatal" errors, which prevent ASIC
  3539.        from successfully compiling your program.  Warnings begin with "* W"
  3540.        and indicate possible errors and informative messages which will not
  3541.        prevent ASIC from generating an executable ".COM" file.
  3542.  
  3543.  
  3544.  
  3545.        ** E001 **  File Extensions must be either ".ASI" or omitted
  3546.  
  3547.             ASIC requires source programs to have the extension ".ASI".
  3548.        Rename your source file with the DOS "RENAME" command to the name
  3549.        "file.ASI", where "file" is your source program name.  Then resubmit
  3550.        the compile.
  3551.  
  3552.  
  3553.  
  3554.        ** E002 ** File Name specified is too long
  3555.  
  3556.             The source file may be identified by a file name up to 124
  3557.        characters long including disk drive specifiers and sub directory
  3558.        names.  Move the source program to a directory which may be specified
  3559.        within this length.
  3560.  
  3561.  
  3562.  
  3563.  
  3564.  
  3565.  
  3566.  
  3567.  
  3568.  
  3569.  
  3570.  
  3571.  
  3572.  
  3573.  
  3574.  
  3575.                                      Page - 55
  3576.  
  3577.  
  3578.  
  3579.  
  3580.  
  3581.  
  3582.  
  3583.  
  3584.  
  3585.        ** E003 ** Error Opening File:  xxxxxxxx.xxx
  3586.  
  3587.             The file indicated by "xxxxxxxx.xxx" could not be opened by ASIC.
  3588.        This error can be issued when ASIC attempts to read your source file,
  3589.        or when it writes any one of the possible output files (".COM",
  3590.        ".LST", or ".SYM").  If indicated file is your source program name,
  3591.        verify the spelling, and either make sure it is in the same directory
  3592.        as ASIC, or specify the full path name for the file.  If the indicated
  3593.        file is an output file, the error is usually a result of a write
  3594.        protect tab on the diskette or insufficient disk space.
  3595.  
  3596.  
  3597.  
  3598.        ** E004 ** DIM Statements must precede all others
  3599.  
  3600.             In ASIC, DIM statements must appear before all other statement
  3601.        types, including REMarks.  Move all of your DIM statements to the very
  3602.        beginning of your source file.
  3603.  
  3604.  
  3605.  
  3606.        ** E005 ** Too many characters in source line
  3607.  
  3608.             Source program lines in ASIC are limited to 120 characters.
  3609.        Change the indicated source line, so that it fits within this limit.
  3610.  
  3611.  
  3612.  
  3613.        ** E006 ** Unmatched Quote ('"') in source line
  3614.  
  3615.             A string constant was found with either no opening or closing
  3616.        quote mark.  Quotation marks must be matched in pairs within source
  3617.        lines.
  3618.  
  3619.  
  3620.  
  3621.        ** E007 ** Token in source line > 82 characters long
  3622.  
  3623.             Individual tokens in ASIC are limited to 82 characters in length,
  3624.        regardless of type.  A token is a group of letters and/or numbers
  3625.        delimited on either side by a space or math symbol.  Example, even
  3626.        though string constants are limited to 80 characters, ASIC considers
  3627.        the "token" to include the quotation marks.  In this case, however,
  3628.        ASIC detected a token longer than the longest possible token, the
  3629.        string constant.  Check for "tokens" or "words" more than 82
  3630.        characters long in the indicated source line.
  3631.  
  3632.  
  3633.  
  3634.  
  3635.  
  3636.  
  3637.  
  3638.  
  3639.                                      Page - 56
  3640.  
  3641.  
  3642.  
  3643.  
  3644.  
  3645.  
  3646.  
  3647.  
  3648.  
  3649.        ** E008 ** More than 30 tokens in source line
  3650.  
  3651.             Since all ASIC statements require less than 30 tokens, ASIC will
  3652.        flag any statement which contains more than this number.  A token is a
  3653.        group of letters and/or numbers delimited on either side by a space or
  3654.        math symbol.
  3655.  
  3656.  
  3657.  
  3658.        ** E009 ** Keyword Unknown:  xxxxxxxxx
  3659.  
  3660.             ASIC detected the symbol indicated by "xxxxxxxx" in your source
  3661.        line, but it was not a valid variable name, constant, label, or ASIC
  3662.        Function Name.
  3663.  
  3664.  
  3665.  
  3666.        ** E010 ** Symbol Table Space Exhausted
  3667.  
  3668.             The symbol table is used by ASIC to keep track of your variables,
  3669.        constants and labels.  It is also used to hold information used in
  3670.        FOR/NEXT processing, and internal system subroutine generation.
  3671.        Reduce the number of LABELS, VARIABLE NAMES, or CONSTANTS in your
  3672.        program, and recompile.
  3673.  
  3674.  
  3675.  
  3676.        ** E011 ** Symbol Incomplete Reference Space Exhausted
  3677.  
  3678.             This table is a sister table to the Symbol Table, it contains
  3679.        references to LABEL type symbols which have been defined in the symbol
  3680.        table.  Try to reduce the number of references made to LABEL symbols
  3681.        within the program and recompile.
  3682.  
  3683.  
  3684.  
  3685.        ** E012 ** No keywords in source line
  3686.  
  3687.             Every ASIC source program line must contain an ASIC keyword (eg.
  3688.        "PRINT", "=", "GOSUB", etc).
  3689.  
  3690.  
  3691.  
  3692.        ** E013 ** Syntax Error
  3693.  
  3694.             The "catch-all" error for ASIC.  This error is usually issued
  3695.        when ASIC has identified an error in the parameters for an ASIC
  3696.        keyword.  The best way to find this error is to refer to the entry in
  3697.        the Keyword Reference (chapter 6) for that particular keyword.
  3698.  
  3699.  
  3700.  
  3701.  
  3702.  
  3703.                                      Page - 57
  3704.  
  3705.  
  3706.  
  3707.  
  3708.  
  3709.  
  3710.  
  3711.  
  3712.  
  3713.        ** E014 ** Undefined Symbol:  xxxxxx
  3714.  
  3715.             ASIC detected a LABEL "xxxxxx" which was referenced, but never
  3716.        defined in the program.  A label is considered to be defined when it
  3717.        is the first token on the source line.  A reference to a label occurs
  3718.        when a label name appears elsewhere in the source statement
  3719.  
  3720.             Example:           PRINTIT:   PRINT "hello"      <---Defined
  3721.                                GOTO PRINTIT:                 <--Referenced
  3722.  
  3723.  
  3724.  
  3725.        ** E015 ** Compiled Code Exceeds 64k-Can't fit in .COM file
  3726.  
  3727.             Your source program is too large to fit in the .COM file format.
  3728.        Eliminate extraneous variables and program statements.  Note:  REM
  3729.        statements do NOT generate any output code, so elimination of REM
  3730.        statements will not alleviate this problem.
  3731.  
  3732.  
  3733.  
  3734.        ** E016 ** Integer Constant Not in range +32767 to -32767
  3735.  
  3736.             The above range of numbers is the maximum which can be contained
  3737.        in integer format in ASIC.  Reduce the constant so that it falls
  3738.        within the specified range.
  3739.  
  3740.  
  3741.  
  3742.        ** E017 ** Duplicate Label:    xxxxxx
  3743.  
  3744.             The indicated label "xxxxxx" was defined more than once in the
  3745.        program.  Reduce the multiple definitions to a single definition and
  3746.        then recompile.
  3747.  
  3748.  
  3749.  
  3750.        ** E018 ** Second FOR defined for variable with no intervening NEXT
  3751.  
  3752.             FOR/NEXT Statements cannot be nested with the same variable name.
  3753.  
  3754.                  VALID                              INVALID
  3755.  
  3756.                  FOR I=1 TO 10                      FOR I=1 TO 10
  3757.                       FOR J=1 TO 20                      FOR I=1 TO 20
  3758.                       NEXT J                             NEXT I
  3759.                  NEXT I                             NEXT I
  3760.  
  3761.  
  3762.  
  3763.  
  3764.  
  3765.  
  3766.  
  3767.                                      Page - 58
  3768.  
  3769.  
  3770.  
  3771.  
  3772.  
  3773.  
  3774.  
  3775.  
  3776.  
  3777.        ** E019 ** For/Next Table Space Exhausted
  3778.  
  3779.             An unlimited of FOR/NEXT statements can exist, however, they can
  3780.        be "nested" to a maximum depth of 25.
  3781.  
  3782.  
  3783.  
  3784.        ** E020 ** NEXT without FOR
  3785.  
  3786.             A NEXT statement was found, however it was not preceded in the
  3787.        source program with a matching FOR statement.
  3788.  
  3789.  
  3790.  
  3791.        ** E021 ** FOR without NEXT at Source Line NNNNN
  3792.  
  3793.             The indicated source line NNNNN contains a FOR statement, for
  3794.        which no NEXT statement was ever found.
  3795.  
  3796.  
  3797.  
  3798.        ** E022 ** Invalid Option:  x
  3799.  
  3800.             An invalid compile option was specified.  Review Chapter 4 for a
  3801.        list of valid compile options.
  3802.  
  3803.  
  3804.  
  3805.        ** E023 ** More than 63000 bytes in Data Segment
  3806.  
  3807.  
  3808.             An ASIC program can be up to 64k bytes in size.  Of this total,
  3809.        63000 bytes can contain program variables and constants, leaving at
  3810.        least 1k for program code.  Reduce the number of variables and
  3811.        constants in your program.
  3812.  
  3813.  
  3814.  
  3815.        ** E024 ** Too many arrays defined
  3816.  
  3817.             A single ASIC source program can contain up to 25 arrays.
  3818.  
  3819.  
  3820.  
  3821.        ** E025 ** Re-DIMension of previously DIMensioned variable
  3822.  
  3823.             Only one DIM statement can be specified per array name.
  3824.  
  3825.  
  3826.  
  3827.  
  3828.  
  3829.  
  3830.  
  3831.                                      Page - 59
  3832.  
  3833.  
  3834.  
  3835.  
  3836.  
  3837.  
  3838.  
  3839.  
  3840.  
  3841.        ** E026 ** Invalid subscript on Array
  3842.  
  3843.             A subscript was found which is not valid.  Either ASIC expected
  3844.        more or less subscripts than were present, or ASIC detected a
  3845.        subscript which was itself an array.  Subscripts on arrays may only be
  3846.        non-array variables and/or integer constants.
  3847.  
  3848.  
  3849.  
  3850.        ** E027 ** String Arrays Are Not Supported
  3851.  
  3852.             A DIM statement specified a string variable type.  Only integer
  3853.        arrays are supported.
  3854.  
  3855.  
  3856.  
  3857.        ** E028 ** Comfile Buffer - Memory Allocation Failed
  3858.  
  3859.             ASIC attempted to allocate memory for an internal buffer .  This
  3860.        memory allocation failed.  More memory is required.  If you have any
  3861.        TSR's loaded in memory, remove them and try again.
  3862.  
  3863.  
  3864.  
  3865.        ** E029 ** Codeseg Buffer - Memory Allocation Failed.
  3866.  
  3867.             ASIC attempted to allocate memory for an internal buffer.  This
  3868.        memory allocation failed.  More memory is required.  If you have any
  3869.        TSR's are loaded in memory, remove them and try again.
  3870.  
  3871.  
  3872.  
  3873.        ** E030 ** Code Segment Memory Exhausted
  3874.  
  3875.             ASIC will attempt to allocate 64k of memory to use a work space
  3876.        to hold the code generated by your program statements.  This message
  3877.        indicates that the amount of memory it was able to allocate was not
  3878.        sufficient to hold the code generated by the program you are trying to
  3879.        compile.
  3880.  
  3881.  
  3882.        ** E031 ** Data Segment Memory Exhausted
  3883.  
  3884.             ASIC will attempt to allocate 64k of memory to use a work space
  3885.        to hold the data segment for your program.  This message indicates
  3886.        that the amount of memory it was able to allocate was not sufficient
  3887.        to hold the data generated by the program you are trying to compile.
  3888.  
  3889.  
  3890.  
  3891.  
  3892.  
  3893.  
  3894.  
  3895.                                      Page - 60
  3896.  
  3897.  
  3898.  
  3899.  
  3900.  
  3901.  
  3902.  
  3903.  
  3904.  
  3905.        ** E032 ** Insufficient Memory to Run ASIC
  3906.  
  3907.             You don't have enough memory to run ASIC.  If you have any TSR's
  3908.        loaded, try removing them and re-compiling.
  3909.  
  3910.  
  3911.  
  3912.        ** E033 ** Edit Buffer Memory Allocation Failed
  3913.  
  3914.             ASIC attempted to allocate memory for the edit buffer in the
  3915.        integrated environment, but was unable to.  If you have any TSR's
  3916.        loaded, remove them from memory, and try again.
  3917.  
  3918.  
  3919.  
  3920.        * W001 * Last Statement Not END -- END supplied
  3921.  
  3922.             Warning only.  Asic expects the last statement of a program to be
  3923.        an END statement.  If it does not find one, it generates one for you.
  3924.  
  3925.  
  3926.  
  3927.        * W002 * Printer Not Ready - 'P' Option Ignored
  3928.  
  3929.             You selected the "Printer" option, but ASIC was not able to
  3930.        access the printer.  Make sure the printer is online before compiling
  3931.        with the 'P' option.
  3932.  
  3933.  
  3934.  
  3935.        * W004 * Edit Buffer Full--File Truncated
  3936.  
  3937.             While loading a file, the edit buffer filled before ASIC reached
  3938.        end-of-file.  The file is truncated in memory.  IF YOU SAVE THE FILE
  3939.        AFTER RECEIVING THIS MESSAGE, PART OF THE FILE WILL BE LOST ON DISK.
  3940.        IT IS RECOMMENDED THAT YOU EITHER EXIT ASIC IMMEDIATELY, OR THAT YOU
  3941.        SAVE THE TRUNCATED FILE UNDER A NEW NAME SO THAT THE ORIGINAL FILE IS
  3942.        NOT DAMAGED.
  3943.  
  3944.  
  3945.  
  3946.  
  3947.  
  3948.  
  3949.  
  3950.  
  3951.  
  3952.  
  3953.  
  3954.  
  3955.  
  3956.  
  3957.  
  3958.  
  3959.                                      Page - 61
  3960.  
  3961.  
  3962.  
  3963.  
  3964.  
  3965.  
  3966.  
  3967.  
  3968.  
  3969.        * W005 *  Edit Buffer Full
  3970.  
  3971.             ASIC issues this message when the edit buffer is full and you
  3972.        attempt to insert a line.  Delete some unnecessary source lines to
  3973.        create space in the edit buffer.
  3974.  
  3975.  
  3976.  
  3977.        * W006 * Source/Dest of Block Copy/Move May Not Overlap
  3978.  
  3979.             You attempted to move or copy a block of lines to a destination
  3980.        line which was within the source block of lines.  Execution of this
  3981.        block move/copy would result in an endless series of copies or moves.
  3982.        Move the cursor outside of the highlighted block of lines, and try
  3983.        again.
  3984.  
  3985.  
  3986.  
  3987.  
  3988.  
  3989.  
  3990.  
  3991.  
  3992.  
  3993.  
  3994.  
  3995.  
  3996.  
  3997.  
  3998.  
  3999.  
  4000.  
  4001.  
  4002.  
  4003.  
  4004.  
  4005.  
  4006.  
  4007.  
  4008.  
  4009.  
  4010.  
  4011.  
  4012.  
  4013.  
  4014.  
  4015.  
  4016.  
  4017.  
  4018.  
  4019.  
  4020.  
  4021.  
  4022.  
  4023.                                      Page - 62
  4024.  
  4025.  
  4026.  
  4027.  
  4028.  
  4029.  
  4030.                                   RUN TIME ERRORS
  4031.  
  4032.  
  4033.  
  4034.        Divide Overflow
  4035.  
  4036.  
  4037.             This message indicates that your program attempted to divide by
  4038.        zero.
  4039.  
  4040.  
  4041.  
  4042.  
  4043.  
  4044.  
  4045.  
  4046.  
  4047.  
  4048.  
  4049.  
  4050.  
  4051.  
  4052.  
  4053.  
  4054.  
  4055.  
  4056.  
  4057.  
  4058.  
  4059.  
  4060.  
  4061.  
  4062.  
  4063.  
  4064.  
  4065.  
  4066.  
  4067.  
  4068.  
  4069.  
  4070.  
  4071.  
  4072.  
  4073.  
  4074.  
  4075.  
  4076.  
  4077.  
  4078.  
  4079.  
  4080.  
  4081.  
  4082.  
  4083.  
  4084.  
  4085.  
  4086.  
  4087.                                      Page - 63
  4088.  
  4089.  
  4090.  
  4091.  
  4092.  
  4093.  
  4094.                                   FILE I/O ERRORS
  4095.  
  4096.  
  4097.  
  4098.        ERROR Codes Set by OPEN --- Mode Input
  4099.  
  4100.        000       No Error
  4101.        002       File Not Found
  4102.        004       File Not Found
  4103.        005       File Access Denied
  4104.        254       File Number Already in Use
  4105.  
  4106.        ERROR Codes Set by OPEN --- Mode Output
  4107.  
  4108.        000       No Error
  4109.        003       Path Not Found
  4110.        004       No File Handle Available
  4111.        005       File Access Denied
  4112.        254       File Number Already in Use
  4113.  
  4114.        ERROR Codes Set by CLOSE
  4115.  
  4116.        000       No Error
  4117.        006       Invalid Handle
  4118.        095       Cannot Close File -- File is not Open
  4119.  
  4120.        ERROR Codes Set by INPUT#
  4121.  
  4122.        000       No Error
  4123.        005       Read Access Denied
  4124.        006       Invalid File Handle
  4125.        096       Input String Truncated at 80 Characters
  4126.        098       File Not Open for Input
  4127.        099       End of File
  4128.  
  4129.        ERROR Codes Set by PRINT#
  4130.  
  4131.        000       No Error
  4132.        005       File Access Denied
  4133.        006       Invalid File Handle
  4134.        097       File Not Open for Output
  4135.        255       Disk Full
  4136.  
  4137.  
  4138.  
  4139.  
  4140.  
  4141.  
  4142.  
  4143.  
  4144.  
  4145.  
  4146.  
  4147.  
  4148.  
  4149.  
  4150.  
  4151.                                      Page - 64
  4152.